In this example, I will show you how to build a bean validator for
User model object.In my previous example, Spring MVC Custom Validator, I have shown how to validate user input.
Validating input received from the user to maintain data integrity is an important part of application logic.
The Bean Validation model is supported by constraints in the form of annotations placed on a field, method, or class of a JavaBeans component, such as a managed bean.
Constraints can be built in or user defined. User-defined constraints are called custom constraints. Several built-in constraints are available in the javax.validation.constraints package. You can read more on bean validation JavaBeans Validation