读配置信息 properties
2015-07-01 13:49
176 查看
private static Properties config = null; static { InputStream in = getProperties.class.getClassLoader().getResourceAsStream( "jerseyconfig.properties");//文件名 config = new Properties(); try { config.load(in); in.close(); } catch (IOException e) { System.out.println("No AreaPhone.properties defined error"); } } // 根据key读取配置 public static String readValue(String key) { // Prop 4000 erties props = new Properties(); try { String value = config.getProperty(key); return value; } catch (Exception e) { e.printStackTrace(); System.err.println("ConfigInfoError" + e.toString()); return null; } }
相关文章推荐
- Yin ~ Regularized Minimization method
- Linux Curl命令
- nginx-configure执行大致流程
- hadoop之单机模式
- Linux设备驱动程序学习(基于2440的GPIO字符设备驱动)
- 零基础学习hadoop
- 解决centos安装 sda必须有一个GPT磁盘标签
- DSR on Openstack POC
- Shell脚本之数组
- 基于消息的分布式架构
- 转cocopods的使用
- bash shell学习-shell script基础 (笔记)
- centos 修改最大打开文件数量。
- centos下安装nodejs及websocket
- Win7 64bit hadoop-2.6.0源码编译部署包
- linux VIM基本命令
- 嵌入式linux入门之c语言学习注意事项总结(二)
- Nginx通过修改连接简单防御CC攻击的方法
- CentOS修改默认运行级别
- Shell脚本实现监视指定进程的运行状态