Skip to main content

Custom Validator

Learn Custom Validator (Validation, Spring MVC) with worked examples, diagrams and interview questions. Free on JavaSchoolLab.

Fresher Notes Custom validator means your own constraint: an annotation plus a ConstraintValidator class that holds the rule. Annotation needs message , groups and payload attributes and @Constraint(validatedBy=...) . Use it like any built-in constraint: put it on a field and add @Valid to the controller parameter.

More lessons in Validation