I'm using hibernate-validator 5.3.0.
The following is my function with @NotNull constraint, where I'm making validation on method parameters.
public void test(@NotNull String firstName, @NotNull String lastName) {
ValidatorFactory factory = Validation.buildDefaultValidatorFactory();
Validator validator = factory.getValidator();
....
}
After reading this question I found that it's possible to put custom error message in ValidationMessages.properties file with this following format:
[ConstraintName].[ClassName].[FieldName]=[Message]
for example
NotNull.TestClass.name=My Custom Message
But this works when you're trying to validate some class fields.
So is it possible to use this or some other format and create custom error messages for method arguments?
Thanks in advance.