读取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);
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应用中properties配置文件(这种方法可能不是最好的)
- web工程中读取properties配置文件方法
- java web项目读取properties文件方法
- 将properties文件的配置设置为整个Web应用的全局变量实现方法
- web项目中读取properties文件的方法总结
- JSP/Servlet Web应用中.properties文件的放置与读取
- 读取web应用下的资源文件(例如properties)
- 项目开发技巧(一):将Web应用打包成war文件的方法总结
- 使用J2SE API读取Properties文件的六种方法
- Java Web Start使用log4j.properties文件的方法
- 读取Properties文件六种方法
- 将Web应用打包成war文件的方法总结
- [ZT]使用J2SE API读取Properties文件的六种方法
- 使用J2SE API读取Properties文件的六种方法
- 使用J2SE API读取Properties文件的六种方法
- 使用J2SE API读取Properties文件的六种方法(选择自 kindani 的 Blog )
- 读取Properties文件的几种方法
- 使用J2SE API读取Properties文件的六种方法
- 读取Properties文件的几种方法
- 用J2SE API读取Properties文件的方法