【发布时间】:2018-11-27 18:59:27
【问题描述】:
我的应用程序配置文件中有多个配置文件application.yml,如下例所示:
spring:
application:
name: my-super-app
database:
secret: "default secret"
this:
that: "default value..."
---
spring:
profiles: staging
---
spring:
profiles: qa
database:
secret: "foo bar"
---
spring:
profiles: playground
database:
secret: "foo bar"
---
spring:
profiles: production
database:
secret: "foo bar"
很明显,我为qa、playground 和production 配置文件冗余设置了database.secret 配置,staging 除外。有没有办法为这三个配置文件设置一次,对配置文件进行分组或从基本配置文件继承?
【问题讨论】:
标签: java spring spring-boot configuration