Skip to content

Clarifying change in config file ordering particularly with respect to spring.config.location and profile-specific files #25058

Open
@barryspearce

Description

@barryspearce

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions