Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/spring-mvc/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Sbt 如何覆盖类型安全配置设置?_Sbt_Typesafe_Typesafe Config - Fatal编程技术网

Sbt 如何覆盖类型安全配置设置?

Sbt 如何覆盖类型安全配置设置?,sbt,typesafe,typesafe-config,Sbt,Typesafe,Typesafe Config,在application.conf文件中,我有如下内容 platform3.operational.state = "development" 我用电脑运行我的服务 sbt "project p3-s-sink" "run -Dplatform3.operational.state=test" 但配置属性仍然是“开发” 如何覆盖类型安全配置设置?来自ConfigFactory.systemProperties()[]的JavaDoc: 注意中间的段落:“加载将包括系统属性作为覆盖,以及def

在application.conf文件中,我有如下内容

platform3.operational.state = "development"
我用电脑运行我的服务

sbt "project p3-s-sink" "run -Dplatform3.operational.state=test"
但配置属性仍然是“开发”


如何覆盖类型安全配置设置?

来自ConfigFactory.systemProperties()[]的JavaDoc:

注意中间的段落:“加载将包括系统属性作为覆盖,以及defaultReference和defaultOverrides”


当您直接执行时,它是否能像预期的那样工作?

也许这个博客可以帮助您:

不幸的是,sbt run不支持java系统属性,所以在运行sbt时不能使用命令行调整设置。sbt revolver插件允许您在分叉JVM中运行应用程序,它确实允许您使用命令行传递java参数


虽然此链接可以回答问题,但最好在此处包含答案的基本部分,并提供链接供参考。如果链接页面在我直接运行时发生更改,则仅链接的答案可能无效。
 * Gets a <code>Config</code> containing the system properties from
 * {@link java.lang.System#getProperties()}, parsed and converted as with
 * {@link #parseProperties}.
 * <p>
 * This method can return a global immutable singleton, so it's preferred
 * over parsing system properties yourself.
 * <p>
 * {@link #load} will include the system properties as overrides already, as
 * will {@link #defaultReference} and {@link #defaultOverrides}.
 *
 * <p>
 * Because this returns a singleton, it will not notice changes to system
 * properties made after the first time this method is called. Use
 * {@link #invalidateCaches()} to force the singleton to reload if you
 * modify system properties.
 *
 * @return system properties parsed into a <code>Config</code>