Skip to content

Inconsistent configuration ordering with profiles #18199

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
kzwang opened this issue Sep 10, 2019 · 2 comments
Closed

Inconsistent configuration ordering with profiles #18199

kzwang opened this issue Sep 10, 2019 · 2 comments
Assignees
Labels
status: waiting-for-feedback We need additional information before we can continue theme: config-data Issues related to the configuration theme type: bug A general bug
Milestone

Comments

@kzwang
Copy link

kzwang commented Sep 10, 2019

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.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Sep 10, 2019
@mbhave mbhave added type: bug A general bug theme: profiles and removed status: waiting-for-triage An issue we've not yet triaged labels Sep 20, 2019
@mbhave mbhave added this to the 2.x milestone Sep 20, 2019
@philwebb philwebb added the for: team-meeting An issue we'd like to discuss as a team to make progress label Sep 27, 2019
@philwebb philwebb self-assigned this Jun 3, 2020
@philwebb philwebb added the theme: config-data Issues related to the configuration theme label Jun 9, 2020
@mbhave
Copy link
Contributor

mbhave commented Jul 30, 2020

@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-SNAPSHOTs. 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?

@mbhave mbhave added status: waiting-for-feedback We need additional information before we can continue and removed for: team-meeting An issue we'd like to discuss as a team to make progress labels Jul 30, 2020
@kzwang
Copy link
Author

kzwang commented Jul 31, 2020

Thanks @mbhave , just did a quick test with 2.4.0-SNAPSHOT and it works as expected

@kzwang kzwang closed this as completed Jul 31, 2020
@wilkinsona wilkinsona removed this from the 2.x milestone Jul 31, 2020
@mbhave mbhave added this to the 2.4.0-M2 milestone Jul 31, 2020
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
status: waiting-for-feedback We need additional information before we can continue theme: config-data Issues related to the configuration theme type: bug A general bug
Projects
None yet
Development

No branches or pull requests

5 participants