In there I show readers how they can implement Spring validations with a simple, clean and DRY approach.
In a nutshell, I suggest the following steps to run validations in functional endpoints:
Implement Spring Validators to evaluate your resources
Create an abstract class (the AbstractValidationHandler) with the basic procedure that any handler will follow when processing a request, leaving up to the children classes what to do when the data is valid
Make your request handler classes extend this abstract class, implementing this abstract method, stating the body it will be expecting, and what validator needs to be used to validate it
I'm thinking it would be nice for Spring to provide an AbstractValidationHandler out-of-the-box for users to use when they need to run validations in their endpoints.
Even though there are probably several aspects on the abstract class that should be refactored so as to be suitable for any scenario, I think it might be a good starting point.
Note: As I explain in the post, creating custom validators can be omitted since we can add bean validation annotations to our resource and inject the default Spring Validator provided by the LocalValidatorFactoryBean bean to our handler.
Of course, if we decide that such a class would be in fact useful, I'd like to work on its development myself, if that's possible.
rozagerardo thanks for the link to the article. The base class isn't providing enough value IMO to justify the rigidity of having to extend a base class. Delegation should work just as well and let you extend any class you want. In any case such a change is beyond the scope for the request.
Ankur Pathak, in the functional style you get the body object back and it's up to you to validate it. You can use facilities available in the Spring Framework to do that, as shown in the article by rozagerardo.
I guess what we can do in the docs is to provide brief guidance on this with pointers to relevant information.