How to add custom error messages in Hibernate validator

前端 未结 1 1323
长情又很酷
长情又很酷 2021-01-12 13:28

I have a simple class like this,

import javax.validation.constraints.NotNull;
import org.hibernate.validator.constraints.Length;

public class Form implement         


        
相关标签:
1条回答
  • 2021-01-12 14:08

    You have this resource bundle file holding the message values.

    I think you have to use the path to the i.e. @NotNull annotation to override the message by hand! like javax.validation.constraints.NotNull=Notnull error happened! or something like that!

    Look here for that :

    Hibernate Validator - The error message

    Hope that helps

    0 讨论(0)
提交回复
热议问题