期望结果:手动修改properties文件中的该参数值后,不需要重启Tomcat(或重新发布),该新参数值要求立即在程序中生效。
我的主要代码:
URL url=TestClass.class.getClassLoader().getResource("test.properties");
String path=URLDecoder.decode(url.getPath(),"UTF-8");
Properties props=new Properties();
props.load(new FileInputStream(path));
String xxx=props.getProperty("yyy");
以上,当修改了yyy对应的参数值后,取得的xxx值仍然为修改前的值!
所以,想求知:实时加载properties要如何实现(JavaWeb项目中)?