Spring validator default message codes not resolving
- by Derek Clarkson
Hi all,
I have a custom spring validator which has the following default message:
public @interface FieldMatch {
String message() default "au.com.xxx.website.FieldMatchValidation";
...
The problem I'm having is that the message code is not being resolved and <form:error...> is simply displaying the code rather than the message (Which is in a properties file which is being used by a ResourceBundleMessageSource).
I've also tried this as
String message() default "{au.com.xxx.website.FieldMatchValidation}";
Which causes the message source to crash with an exception indicating that it thinks that the "{}" brackets should contain a number because it thinks it's a parameter place holder.
I think that the issue is that the message code is not being seen as a message code and therefore not resolved, but I cannot figure out why.
Any suggestions?