您的位置:首页 > 运维架构

读取web应用的properties文件方法

2017-09-07 13:33 316 查看
InputStream is = null;

Properties pro = new Properties();

is = this.getClass().getClassLoader().getResourceAsStream(“xxx.properties”);

try {

pro.load(is);

} catch (IOException e) {

e.printStackTrace();

}

String smtp = operator.getEmail().split(“@”)[1].split(“\.”)[0];

mailhost = pro.getProperty(smtp);

ip = pro.getProperty(“socketServer_ip”);

port = pro.getProperty(“socketServer_port”);

IOUtils.closeQuietly(is);
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  web应用