I have the following application.yml file:
---
spring:
profiles: a & b
test1: 1
test2: 1
---
spring:
profiles: a & b
test1: 2
---
spring:
profiles: a & b & c
test2: 2
---
spring:
profiles: a
test3: 1
---
spring:
profiles: a
test3: 2
Based on documentation https://docs.spring.io/spring-boot/docs/current/reference/html/howto-properties-and-configuration.html#howto-change-configuration-depending-on-the-environment, I would expect Later values override earlier values
I'm running the application with profile a
, b
, and c
. However, I'm getting 2
for test3
(expected), but I'm getting 1
for both test1
and test2
. So the ordering is opposite when spring.profiles
contains a single profile vs an expression.
This works as expected if profiles are comma-separated, but not using profile expression.
Comment From: mbhave
@kzwang We have overhauled processing of configuration files and profiles in 2.4.x. This should work as expected now with the 2.4.0-SNAPSHOT
s. With multi-document files, later documents will override the properties defined in earlier ones. Could you give it a try with the latest snapshots and let us know if this works for you?
Comment From: kzwang
Thanks @mbhave , just did a quick test with 2.4.0-SNAPSHOT and it works as expected