Spring @Valid and JSON
a neat feature of Spring 3.1 is the ability to set @ExceptionHandler for types thrown by controller methods. in a JSON scenario, we may wish to format the error back to the client and the @ExceptionHandler allows us to do exactly that.
here's how to do it;
let's create the entities, including an error encapsulating entity
now create an abstract error controller (for reuse design)
now let's use that in a controller
and, of course, the wiring
No comments:
Post a Comment