Java 中是否可以堆叠加载的属性?例如我可以这样做:
Properties properties = new Properties();
properties.load(new FileInputStream("file1.properties"));
properties.load(new FileInputStream("file2.properties"));
并从两者访问属性?
你可以这样做:
Properties properties = new Properties();
properties.load(new FileInputStream("file1.properties"));
Properties properties2 = new Properties();
properties2.load(new FileInputStream("file2.properties"));
properties.putAll(properties2);
注意:所有维护的密钥都是唯一的。因此,使用相同键加载的后续属性将被覆盖。只是为了保留给您参考:)
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)