2013-05-16 37 views
0

我在jboss 6服务器的conf目录中有一个属性文件。使用jboss 6属性服务重新获取属性值

如何我可以从我的应用程序内部的文件中获取一组或所有键和值:

<attribute name="URLList"> 
    ./conf/crawler.properties 
</attribute> 

感谢

+0

属性驻留在服务器端的可用位置,因此它可以通过url到达。 –

+0

我正在尝试使用org.jboss.util.property。*类来检索键和值...但这不工作:( – Moam

回答

1

这样做,但使用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>)。