Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在 jboss 6 服务器的 conf 目录中有一个属性文件。
我如何在我的应用程序中从该文件中获取组或所有键和值:
<attribute name="URLList"> ./conf/crawler.properties </attribute>
谢谢
这样做了,但使用java.util.Properties:
java.util.Properties
String path = System.getProperty("jboss.server.config.url") + propertiesFileName; Properties props = new Properties(); URL url = new URL(path); props.load(url.openStream());
该类Properties具有读取键值对的所有必要方法(它还实现Map<Object,Object>)。
Properties
Map<Object,Object>