{
"code": "TEST_CODE",
"message": "Test message"
}
I just did release 1.2.0 of the error-handling-spring-boot-starter library. It allows now to customize how the error response is serialized to JSON.
By default, the library uses this:
{
"code": "TEST_CODE",
"message": "Test message"
}
If you like to use other field names, you can do this now via application.properties
.
For example, adding this:
error.handling.json-field-names.code=errorCode
error.handling.json-field-names.message=description
will result in this JSON instead:
{
"errorCode": "TEST_CODE",
"description": "Test message"
}
The library is available on Maven central so you can easily include it in your build. Read more details at https://www.wimdeblauwe.com/blog/2020/07/20/error-handling-library-spring-boot/ or check out the documentation at the GitHub page.