读取web应用的properties文件方法
生活随笔
收集整理的这篇文章主要介绍了
读取web应用的properties文件方法
小编觉得挺不错的,现在分享给大家,帮大家做个参考.
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应用的properties文件方法的全部内容,希望文章能够帮你解决所遇到的问题。
- 上一篇: 拒绝服务
- 下一篇: VS的几个实用快捷键