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

你可能感兴趣的:(property)