Reference Documentation: instruct how RestTemplate should handle the errors thrown about @Validated (JSR 303/349) [SPR-14724] #19289
In the current Reference Documentation, for the 28.10 Accessing RESTful services on the Client section.
Why not add a section about how
I have seen some tutorials but seems the developer must write his own code. Even more, I did realise exists many approaches, in some way verbose until some point.
Therefore just curious what is the best approach recommended by the source (Spring Reference documentation) with the current version
Thanks by your understanding.
Affects: 4.3 GA, 4.3.1, 4.3.2, 5.0 M1
The text was updated successfully, but these errors were encountered:
Rossen Stoyanchev commented
I'm not quite sure what you mean. By default in the case of validation errors, the server responds with a 400 status code. Are you looking to add a response body with more details? Or are you asking something else?
There is a base class called ResponseEntityExceptionHandler that can be useful for generating error responses with error details. See the reference. Generally speaking however we've considered in the past providing support for writing errors to the body but have rejected it because it is very application specific. See for example #17136. Also note that Spring Boot does generate error details in the response body and that makes perfect sense in the context of a more opinionated solution.
Manuel Jordan commented
I already have resolved this. I did it manually and doing a research in google. It working with the
My point was indicate or give some clues to the developer about best practices about how handle this.
To be honest when I do a research through the reference documentation, I always start looking for snippet code, later I analyze the theory. Yes I know, is a huge documentation and has no sense add a snippet code for each section.
Since this is not critical, you can proceed to close this ticket.
As usual thanks by your support.