java读取properties文件
2016-04-06 10:57
531 查看
public class CityNoUtil { private static Properties message = new Properties(); static{ InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream("cityno.properties"); try { message.load(is); } catch (IOException e) { e.printStackTrace(); } } public String getMessageByKey(String key){ return message.getProperty(key,AjaxResponse.ERROR); } }
相关文章推荐
- java 度取上传 excel 文件信息,全部转换为字符串
- XML的四种解析方式
- eclipse中添加j2ee插件
- eclipse安装spring和hibernate插件经验
- java语言程序设计第十版(Introduce to java 10th) 课后习题 chapter12-11
- JAVA多维数组的遍历
- C#当中的泛型和java中的对比
- Java多线程学习
- 基于JSR-303与springMVC 4的自定义后台校验
- mybatic详细基础介绍,并介绍spring mvc + mybatic
- Spring的IntializingBean和Init-method的应用
- myeclipse中的可视化图形界面
- 如何使用java合并多个文件
- Java单元测试(Junit+Mock+代码覆盖率)
- springboot集成dubbo
- java maven 生成可执行jar
- Java中的线程(一)
- java高级之callable与future
- cglib与JDK动态代理适用场景
- eclipse 错误:Description Resource Path Location Type Target runtime