spring boot的配置优先级顺序
- [x] 我已经检查过discussions
- [x] 我已经搜索过issues
- [x] 我已经仔细检查过FAQ
描述bug apollo配置的优先级高于命令行参数,导致启动脚本中设置的命令行参数失效。
https://github.com/apolloconfig/apollo/issues/1800#issuecomment-465455448
这一行代码导致了apollo的优先级是最高的,但是 -D配置的优先级高于apollo的配置,是因为下面的代码。
我尝试将apollo的配置优先级降低,添加到命令行参数后面,这样脚本的命令行参数就优先于apollo配置。

期望 命令行参数优先级高于apollo配置
The apollo-client-config-data uses the Config Data Loader pattern, which should prevent this issue from happening. It uses the PureApolloConfig, which won't read from System Property or System Env.
As for this specific issue, maybe we could add a config to let the user config the order of apollo property source?
现在是 -Dserver.port 不会被 apollo 覆盖,--server.port 会被 apollo 覆盖。是否 apollo 不应该覆盖启动脚本中设置的配置?
@shenhuaxin 你描述的应该是正确的行为,目前的实现没有兼容 --args 的场景。
我是从 spring-boot 的 org.springframework.boot.cloud.CloudFoundryVcapEnvironmentPostProcessor#postProcessEnvironment 中看到了下面的写法。 感觉这种方案可行。。

I suppose we could add some configs to adjust the property source overriden behavior just like what spring cloud does.
我明白了你的意思了,我会阅读一下这方面的源码,尝试提交一个pr添加这个功能。