I have a gradle build using multiple profiles to provide configuration overrides for different environments (live + dev).

app-base.properties is located inside the war app-dev.properties is located outside the war in the top directory of the build so gradle bootRun will run with app-dev.properties overriding app-base.properties.

logging.file.name in app-base.properties is set to the live deployment logging directory. logging.file..name in app-dev.properties is set to ./app.log

This setup has worked for the last 12 months, the gradle configuration that works is:

plugins
{
    id 'com.github.ben-manes.versions' version '0.36.0'
    id 'org.springframework.boot' version '2.3.8.RELEASE'
}
...
bootRun
{
  args = ["--spring.config.name=app", "--spring.config.location=file:./,classpath:/config/", "--spring.profiles.active=base,dev" ]
}

An upgrade to 2.4.2 with the following plugins, breaks the execution.

plugins
{
    id 'com.github.ben-manes.versions' version '0.36.0'
    id 'org.springframework.boot' version '2.4.2'
}

Here the logging.file.name set in app-dev.properties is ignored. The app-base.properties is used instead. To resolve I have had to downgrade back to 2.3.8.RELEASE.

Comment From: wilkinsona

Have you seen the section in the release notes and the migration guide to which it links? If not, please take a look and let us know if it helps.

Comment From: barryspearce

Thanks for that - not immediately obvious, although I have sorted it.

So the guide says:

With Spring Boot 2.3 and earlier, the order that the individual documents were added was based on profile activation order.

This is the key. I have been using profiles of base,dev with a spring.config.location=file:./,classpath:/config/. Of course this meant my external file did override the internal due to profile activation order. In 2.4 the location order now takes precedence and it is then fairly obvious that I specify the local directory first. So simple fix to reverse the ordering on spring.config.location.

No bug - although maybe worth an extra note in the migration guide because the behaviour of spring.config.location in combination with the profiles is not mentioned.

Thanks for your help!

Comment From: wilkinsona

maybe worth an extra note in the migration guide because the behaviour of spring.config.location in combination with the profiles is not mentioned

That sounds like a good idea to me. Thanks for the suggestion. The section you've referenced is specifically about multi-document YAML files which you weren't using so there's definitely some room for improvement.

I've re-opened this issue as a reminder to update the guide.

Comment From: wilkinsona

We should probably reword "As of Spring Boot 2.4, external file always override packaged files (profile-specific or not)". The "always" only applies when using the default locations. If they're overridden and their ordering is changed, the "always" no longer holds true.