1
在我的文件 “struts-config.xml中” 我说:Struts的1.2.9重装application.properties
当我的应用程序的启动加载成功application.properties。
我如何重新加载此特性(因为我想改变大量财物文件里面写)无重新申请?
非常感谢。
T.
在我的文件 “struts-config.xml中” 我说:Struts的1.2.9重装application.properties
当我的应用程序的启动加载成功application.properties。
我如何重新加载此特性(因为我想改变大量财物文件里面写)无重新申请?
非常感谢。
T.
使用(从http://www.docjar.com/html/api/com/opensymphony/xwork2/util/LocalizedTextUtil.java.html):
...
clearMap(ResourceBundle.class, null, "cacheList");
// if it's Tomcat
if ("org.apache.catalina.loader.WebappClassLoader".equals(cl.getName())) {
clearMap(cl, loader, "resourceEntries");
}
...
private static void clearMap(Class cl, Object obj, String name)
throws NoSuchFieldException, IllegalAccessException,
NoSuchMethodException, InvocationTargetException {
Field field = cl.getDeclaredField(name);
field.setAccessible(true);
Object cache = field.get(obj);
synchronized (cache) {
Class ccl = cache.getClass();
Method clearMethod = ccl.getMethod("clear");
clearMethod.invoke(cache);
}
}
很明显,你可以导入库,如果你想太多使用它。
所以你想在不重新启动容器的情况下更改struts配置和.properties文件中的属性? – amischiefr 2009-07-08 15:07:42