I\'ve written a validation annotation implemented by a custom ConstraintValidator. I also want to generate very specific ConstraintViolation objects th
ConstraintValidator
ConstraintViolation
If you use message codes you can simply add something like {0} in them.
For example: "The field {0} must not be empty."
And then use hibernateContext.addMessageParameter("0", fieldName); instead of addExpressionVariable(...).
hibernateContext.addMessageParameter("0", fieldName);
addExpressionVariable(...)
That worked for me.