Manually call Spring Annotation Validation

后端 未结 6 1693
太阳男子
太阳男子 2020-11-29 02:42

I\'m doing a lot of our validation with Hibernate and Spring Annotations like so:

public class Account {
    @NotEmpty(groups = {Step1.class, Step2.class})
          


        
6条回答
  •  情歌与酒
    2020-11-29 03:19

    If you have everything correctly configured, you can do this:

    @Autowired
    Validator validator;
    

    Then you can use it to validate you object.

提交回复
热议问题