Building Dynamic ConstraintViolation Error Messages
问题 I've written a validation annotation implemented by a custom ConstraintValidator . I also want to generate very specific ConstraintViolation objects that use values computed during the validation process during message interpolation. public class CustomValidator implements ConstraintValidator<CustomAnnotation, ValidatedType> { ... @Override public boolean isValid(ValidatedType value, ConstraintValidatorContext context) { // Figure out that the value is not valid. // Now, I want to add a