Tuesday, June 21, 2011

Refresh Resource Bundle


  • Resource bundle can not be refreshed using ResourceBundle class. using following code do not clear the cache.
Class type = ResourceBundle.class;
Field cacheList = type.getDeclaredField("cacheList");
cacheList.setAccessible(true);
((Map)cacheList.get(ResourceBundle.class)).clear();
  • If you want to refresh resource bundle of your application you should need to use Resource bundle manager instead of Resource bundle class.
ResourceBundleManagerRT rt = (ResourceBundleManagerRT)ResourceBundleManagerRT.getResourceBundleManager();
 rt.flush();

No comments:

Post a Comment