Fanooos
Fanooos

Reputation: 2828

spring refresh i18n at runtime

We have a spring application in which we store the i18n messages and keys in a properties files app_ar.properties & app_en.properties

Also we use the reloadableResourceBundleMessageSource as a message source.

now I need to edit one of the properties files and reload it so I edit the file and clear the reloadableResourceBundleMessageSource cache.

On my machine every thing is going fine but on the test server or the production server it does not work?

what would be the problem ????

Upvotes: 2

Views: 2122

Answers (1)

Vincent Devillers
Vincent Devillers

Reputation: 1628

As described in the javadoc:

"In contrast to ResourceBundleMessageSource, this class supports reloading of properties files through the "cacheSeconds" setting, and also through programmatically clearing the properties cache. Since application servers typically cache all files loaded from the classpath, it is necessary to store resources somewhere else (for example, in the "WEB-INF" directory of a web app). Otherwise changes of files in the classpath will not be reflected in the application."

Upvotes: 3

Related Questions