java读取配置文件

时间:2016-08-05 03:13:31
【文件属性】:

文件名称:java读取配置文件

文件大小:2KB

文件格式:TXT

更新时间:2016-08-05 03:13:31

读取配置文件 java properties

public class CommonParam { private String propertyFileName; private ResourceBundle resourceBundle; public CommonParam() { propertyFileName = "com/test/dao/SysConfig"; resourceBundle = ResourceBundle.getBundle(propertyFileName); } public String getString(String key) { if (key == null || key.equals("") || key.equals("null")) { return ""; } String result = ""; try { result = resourceBundle.getString(key); } catch (MissingResourceException e) { e.printStackTrace(); } return result; } }


网友评论