Spring Form Validation Multiple MessageResources

24 views Asked by At

I'm working on migrating a legacy Struts application to Spring (pray for my poor soul)

This application has multiple Message Resource/ ResourceBundles that are module specific (e.g. Scheduling_en_US.properties, Onboarding_en_US.properties)

I'm using a combination of Annotation based validation and Custom Validators to build up my BindingResults. I'm having trouble translating the error codes to their appropriate values using the message resources.
<ApplicantForm.class>

@NotBlank(message = "{input.error.applicantType.required}")
private String applicantType;

I'm not sure at all how to resolve this using a specific Message Resource. Is there some tag I can add to the Form bean or Controller or somewhere to specify in the jsp when using the form:errors tag to specify which message resource bundle to use?

I've seen some examples of setting up ReloadableResourceBundleMessageSource as the MessageSource in the App config, but not sure how that gets me closer to where I need.

I realize I'm probably doing things in an odd way, and you probably think I should split out each of these modules into their own application and while true is entirely out of scope of my task.

I appreciate any help you can throw my way.

Thanks

0

There are 0 answers