上一篇 Spring Cloud Config
Hoxton
由集 spring.cloud.config.allow-override=true
,您可以覆盖 localhost
中的配置application.yaml
.
但在新Spring Boot 2.4
版本和 spring.config.import
命令,设置此属性不会更改任何内容,并且配置不会覆盖 localhost
application.yaml
.
我怎样才能在新版本中做到这一点?是否有替代解决方案可以在本地环境中测试覆盖配置?
最佳答案
我刚刚添加了一个新的例如application-dev1.yml
除了其他 yml 文件(在这种情况下除了 test
),我在 application.yml
中设置了事件配置文件如下
spring:
profiles:
active: test, dev1
这个对我有用
关于Spring Cloud 配置允许在 Spring Boot 中覆盖,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67445781/