public class PropertiesUtils {
private static Properties properties = null;
static {
if(null == properties){
properties = new Properties();
InputStreamReader reader = null;
try{
reader = new InputStreamReader(PropertiesUtils.class.getClassLoader().getResourceAsStream("resources.properties"),"utf-8");
properties.load(reader);
reader.close();
}catch (Exception e){
e.printStackTrace();
}finally {
if(reader != null){
reader = null;
}
}
}
}
private PropertiesUtils(){}
public static String getString(String key){
return properties.getProperty(key);
}
}
[java]PropertiesUtils操作属性文件
猜你喜欢
转载自blog.csdn.net/u010989191/article/details/53436716
今日推荐
周排行