【问题标题】:lightbend/config does not see the valuelightbend/config 看不到值
【发布时间】:2021-06-06 05:36:29
【问题描述】:

我尝试在我的 Java Maven 项目中实现 lightbend/config。在根目录中,我有 application.conf 文件,如下所示:

"adminPassword": "xxxxxxxxxxxx"

"whatever": {
  "sub-whatever": "aaaaaaaaaaaa"
}

我这样称呼它:

Config conf = ConfigFactory.load();
System.out.println( conf.getString("adminPassword") );
System.out.println( conf.getString("whatever.sub-whatever") );

这段代码给我一个错误:

ConfigException$Missing:系统属性:未找到密钥“adminPassword”的配置设置

谁能告诉我这段代码或设置有什么问题?

【问题讨论】:

    标签: java configuration config app-config


    【解决方案1】:

    看来路径是错误的。它必须在包目录中,也必须在资源目录中。

    C:\SeleniumTests\projectName\src\test\resources\application.conf
    

    【讨论】:

      猜你喜欢
      • 2020-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-07-07
      • 1970-01-01
      • 1970-01-01
      • 2016-08-17
      • 2017-10-27
      相关资源
      最近更新 更多