Posted by: bgopi | February 13, 2012

Resource Bundle not getting updated dynamically – clear cache issue

Resource Bundles can be updated dynamically,  in case of labels it will happen immediately once you flush. When a mail id or some property read into java class from a resource bundle, it will not get updated dynamically after you flush resource bundle. It happens only on the restart of servers.  This is because, spring singletons are loaded during startup,  they read properties during this phase and cached in memory. Though I update bundle dynamically and flush it, cached class is not going to read it again from property file, unless you reload classes into context. We can write code to reload to context again.

But I suggest below simple and elegant way to do it.

ResourceBundle myBundle = ResourceBundle.getBundle(“com.test.myBundle”);

Note: Check my other post in solutions category for how to create a page that can be used to flush resource bundle content and update them dynamically.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s


%d bloggers like this: