We recently upgraded our app to Spring Boot 2.4+ and our config server to 3.1.4 and found an issue with precedence of different config files. I'm not sure if I have the wrong expectation or if this is a bug.

We have the following config files in our Git repo:

application.yml application-qa.yml foo.yml (includes a default doc and a doc with spring.config.active.on-profile: qa)

Assume our app is named "foo". If I put the same property name in all three files with different values, the one that "wins" is the one in application-qa.yml when qa is the active profile. I.e.

1) application-qa.yml 2) foo.yml (for qa profile) 3) foo.yml (for the default doc) 4) application.yml

I can see this in my app as well as by hitting the config server directly, in which case the docs appear in the result in the above order. I would have expected application-qa.yml to be #3. I.e.

1) foo.yml (for qa profile) 2) foo.yml (for the default doc) 3) application-qa.yml 4) application.yml

The docs make it clear that application.yml should lose to foo.yml and that is working, but it's less clear on application-{profile}.yml files. I'm considering migrating the values in our application-{profile}.yml files into profile activated docs within the application.yml file because this seems to achieve the desired precedence, but it doesn't seem like we should have to do this (and it's not a small change and we'd have to test against all our apps).

Comment From: kcbaltz

Doing some further experimentation, I'm finding that if I add a foo-qa.yml file, that will win over a application-qa.yml which seems to make sense. This does seem to be different from the old config server (2.2) which prioritized the qa profile section of foo.yml over anything in application-qa.yml

Comment From: ryanjbaxter

Were you able to solve this issue? Have you tried with the latest versions of Spring Boot and Spring Cloud?

Comment From: spring-cloud-issues

If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.

Comment From: spring-cloud-issues

Closing due to lack of requested feedback. If you would like us to look at this issue, please provide the requested information and we will re-open the issue.