I've been working on a web service that I've been building in Spring Boot, however one issue I've come across is that when Spring Boot comes across a problem, the structure of the JSON response it generates doesn't match the structure of errors I'm generating in endpoints. The problem with this is that the clients of the service are required to interpret multiple error response structures, which really is unnecessary. The structure of a default error generated by Spring Boot might look something like this;

While the errors generated in my endpoints are returned in a completely different structure. It is possible for an endpoint to return multiple errors in the service I'm working on, so my error responses look something like this;

In an idea world I'd like the responses generated by Spring Boot to follow the structure I'm using about. It turns out this is pretty easy, you just need to create a configuration class that Spring Boot will use, and here's mine;