Profile - Kuangcp/Note GitHub Wiki
目录 start
目录 end|2020-07-05 14:58|
[main]
debug=true
[client]
timeOut=10
Human-Optimized Config Object Notation
Nginx 的配置文件就是使用该格式
通过ResourceBundle获取classPath下的属性文件
ResourceBundle bundle = ResourceBundle.getBundle("test");
String city = bundle.getString("name");
通过Properties对象获取配置文件
Properties pro = new Properties();
pro.load(new FileInputStream(new File("./test.properties")));
String name = (String) pro.get("name");
使用Properties保存配置文件
Properties pro = new Properties();
pro.setProperty("name", "java");
pro.setProperty("study", "sdf");
pro.store(new FileOutputStream(new File("test.properties")), "one file");
可阅读性强, 结构清晰, 但是太繁杂, 信息承载比重小
yaml is ain't markup language
-
Springboot将这种配置文件引入了我的视野,使用这个用来自定义配置文件要特别注意采用小写(不然影响反射中set方法)
二进制的JSON Wikipedia: Smile