如何读取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;

猜你喜欢

转载自zcr789654123.iteye.com/blog/1074414
今日推荐