bootstrap.yml和application.yml问题

Awbeci
  • 2.6k

我有bootstrap.yml、bootstrap-test.yml、bootstrap-prod.yml和application.yml、application-test.xml、application-prod.yml6个文件.

下面是我的bootstrap.yml

spring:
  profiles:
    active: prod

下面是我的application.yml

spring:
  profiles:
    active: test

如果现在我运行起来之后,bootstrap.yml中的active:prod起作用了,而application.yml里面的action:test感觉被它覆盖了,不起作用,这个咋解决

回复
阅读 256
1 个回答
By default, bootstrap properties (not bootstrap.properties but properties that are loaded during the bootstrap phase) are added with high precedence, so they cannot be overridden by local configuration.

来源:https://cloud.spring.io/sprin...

bootstrap.yml 的优先级高于 application.yml,两个文件出现相同的配置项优先使用 bootstrap.yml 。

你知道吗?

宣传栏