Error Handling Spring Boot Starter release 1.2.0

Posted at — Feb 18, 2021
Riekpil logo
Learn how to test real-world applications with the Testing Spring Boot Applications Masterclass. Comprehensive online course with 8 modules and 130+ video lessons to master well-known Java testing libraries: JUnit 5, Mockito, Testcontainers, WireMock, Awaitility, Selenium, LocalStack, Selenide, and Spring's Outstanding Test Support.

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:

application.properties
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.

If you want to be notified in the future about new articles, as well as other interesting things I'm working on, join my mailing list!
I send emails quite infrequently, and will never share your email address with anyone else.