读书人

怎么读取property配置文件

发布时间: 2012-09-10 11:02:32 作者: rapoo

如何读取property配置文件
如何读取property配置文件:

Resource res = new ClassPathResource("文件名.property");
Properties prop = new Properties();
try {
prop.load(res.getInputStream());
} catch (IOException e) {
e.printStackTrace();
}

INTERFACE_HOST = prop.getProperty("interface.host");
SIP_HTTP_PORT = prop.getProperty("sip.http.port");
INTERFACE_SIP = INTERFACE_HOST + ":" + SIP_HTTP_PORT;

读书人网 >软件架构设计

热点推荐