Create interface *MyCustomValidation *and use as default message a message having the same message key name as the name of the just created interface (in our case the default message would be *"{MyCustomValidation}"*).
If you then try to override the default message as follows it will fail:
constraintValidatorContext.buildConstraintViolationWithTemplate("some-other-message").addConstraintViolation(); constraintValidatorContext.disableDefaultConstraintViolation(); |
|