【发布时间】:2020-07-14 19:54:47
【问题描述】:
在我的 Spring 项目中,我创建了一个 config.conf 来存储一些变量。
在课堂上我需要读取这些变量。
我正在使用config 库https://github.com/lightbend/config。
正如文档所说,我尝试使用
private static final Config config = ConfigFactory.load(basename here goes here);
加载config.conf 文件。
通过文档https://lightbend.github.io/config/latest/api/com/typesafe/config/ConfigFactory.html#load-java.lang.String-,此方法接收一个字符串作为类路径资源基名。
我想知道如何获取config.conf 文件的这个“类路径资源基名”?
我的项目结构:
谢谢!
【问题讨论】:
标签: java spring spring-boot config