Question

I'm using hibernate validator framework with Spring. A class implementing the Spring Validator validates objects with Hibernate's ClassValidator. To localize ClassValidator's error messages I need to pass a ResourceBundle into the class' constructor. My ApplicationCountext has a MessageSource bean (ReloadableResourceBundleMessageSource) which is used throught the application. It makes sense to use this same MessafeSource for the ClassValidator. But how do I convert the MessageSource to a ResourceBundle? Is there any adapter class?

Was it helpful?

Solution

MessageSourceResourceBundle sounds like what you are looking for. (Haven't tried it myself.)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top