java - Loading resourcebundle from non default location in struts2 -
There is a mechanism to load struts2
from the file system? I am coming with a hot deployment mechanism if I update the war file, it will be redistributed. I am able to reload the property file on the fly using
LocalizedTextUtil.clearDefaultResourceBundles (); LocalizedTextUtil.addDefaultResourceBundle ("struts / resources");
but it will only appear in the struts2
default location
Any solution, hack, workaround is welcomed from the heart.
I got a solution
first struts.properties struts.custom.i18n .resources = globalMessages - Then, add your startup circle or code to another location that will execute where the server starts
url [] URL; {File file = new file ("/ your path"); Url = file.toURI () ToURL (); Url = new url [] {url}; Classloader cl = new url class loader (url); LocalizedTextUtil.setDelegatedClassLoader (CL); LocalizedTextUtil.addDefaultResourceBundle ("globalMessages"); } Catch (malmarmdureleuxation E) {e.printStackTrace (); }
Comments
Post a Comment