读取web应用的properties文件方法

来源:互联网 发布:网络营销策划书的作用 编辑:程序博客网 时间:2024/05/16 03:05

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);

原创粉丝点击