I am using @NotEmpty annotation from Hibernate validator. However I am required to provide custom message. Thus I am trying the following in order to eliminate duplicate code
@org.hibernate.validator.constraints.NotEmpty
public @interface NotEmpty {
String message() default "{notempty}";
}
Is above the right way to do that ? May I know what’s the term of this annotation overriding ?
If you want to provide default message change the value of key
org.hibernate.validator.constraints.NotEmpty.messageinsideValidationMessages.propertiesthere is no need to have another annotation. Also this is defualt message you can anyways specify message while declaring annotionYou can read more about anotations on Annotation Processing