Database-driven resource bundle in Spring
basename
is a string, so it is not a spring bean, and hence no injection there.
What you can try to do is to subclass ReloadableResourceBundleMessageSource
and override some methods there (for example - getMessage(..)
). The DAO should be injected in the subclass.
ReloadableResourceBundleMessageSource
creates an instance of the class named by the basename
property. This instance will not have any of its dependencies injected by Spring. That's why the textDAO
field in your Messages
object is null.
This Spring issue has the source code for an example JDBC backed MessageSource, as an attachment, which you can use instead of ReloadableResourceBundleMessageSource
.