After upgrading to 2.3. X.release, the default validation was removed. After I manually added the spring-boot-starter-validation dependency, I found result was different .
Before:
{
"timestamp": "2020-06-09T06:30:56.456+0000",
"status": 400,
"error": "Bad Request",
"errors": [
{
"codes": [
"NotBlank.testClass.name",
"NotBlank.name",
"NotBlank.java.lang.String",
"NotBlank"
],
"arguments": [
{
"codes": [
"testClass.name",
"name"
],
"arguments": null,
"defaultMessage": "name",
"code": "name"
}
],
"defaultMessage": "不能为空",
"objectName": "testClass",
"field": "name",
"rejectedValue": null,
"bindingFailure": false,
"code": "NotBlank"
}
],
"message": "Validation failed for object='testClass'. Error count: 1",
"path": "/test"
}
Now:
{
"timestamp": "2020-06-09T07:19:29.794+00:00",
"status": 400,
"error": "Bad Request",
"message": "",
"path": "/test"
}
What can I do to make the result the same as before?
Comment From: snicoll
@qq253498229 please review the release notes before upgrading.
The validation starter change is covered in a dedicated section and so is the change in output.
Comment From: qq253498229
@qq253498229 please review the release notes before upgrading.
The validation starter change is covered in a dedicated section and so is the change in output.
Thanks a lot, it solved my problem.