use of org.springframework.validation.beanvalidation.CustomValidatorBean in project yyl_example by Relucent.
the class CustomValidatorExample method main.
public static void main(String[] args) {
CustomValidatorBean validator = new CustomValidatorBean();
validator.afterPropertiesSet();
Sample sample = new Sample();
Errors errors = new MapBindingResult(new HashMap<>(), Sample.class.getName());
validator.validate(sample, errors);
for (ObjectError error : errors.getAllErrors()) {
System.out.println(error.getDefaultMessage());
}
}
Aggregations