How do I wire up a Spring ValidationMessages bundle in a custom Webflow Validator class? I have a validator implemented and working:
public void validateBusinessReferences(BusinessReferencesViewDao businessReferences, Errors errors) {
if (somecondition())) {
errors.rejectValue("name", "validation.message123", "This field is bad.");
}
}
But instead of the message from the ValidationMessages.properties file, I get the fallback default of This field is bad.
All my other messages and validations work fine - it's just this custom validator/custom message scenario that's failing. I suspect a Spring configuration problem of some kind but I can't isolate it.
Problem solved - I was missing a step. In order to use a properties bundle you need to use a MessageResolver and call it like so:
Where your messageSource is your Spring bean with your message properties bundles, defined in your application context:
Documentation on MessageResolver is here.