Hibernate validation error - @Size

后端 未结 2 1960
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-22 10:29

I have User entity and I try validate field password for length in my test.

My User Class:



        
2条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-01-22 11:00

    I realize the post is bit old and probably resolved. Just wanted to updated anyway if someone else encounter the same issue. As Mufanu added in the comment this will resolve if we add message attribute in the annotation

    @not null works fine without message

    @Size(min = 5, max = 6, message = "size must be between 5 and 6")
    private String password;

提交回复
热议问题