05:09:37
HOCON github https://github.com/lightbend/config/blob/master/HOCON.md
相较于 XML, JSON, YAML 更强大和更人性化的配置文件格式。HOCON
idea 可以从下载 HOCON 插件, 文件格式以 .conf 为后缀。如遇到IDEA 卡住,则重启 IDEA.
<!-- https://mvnrepository.com/artifact/com.typesafe/config --> <dependency> <groupId>com.typesafe</groupId> <artifactId>config</artifactId> <version>1.3.3</version> </dependency>
读取时
导入 typeSage lib
private static final Config config = ConfigFactory.load()
String config = config.getString("product.series");
自定义路径加载
ConfigFactory.parseFile(new File(".....conf"))