Skip to content

Profile specific application properties files are loaded in wrong order in Spring Boot 2.0.2 #13299

New issue

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

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

Already on GitHub? Sign in to your account

Closed
44past4 opened this issue May 30, 2018 · 1 comment
Labels
status: duplicate A duplicate of another issue

Comments

@44past4
Copy link

44past4 commented May 30, 2018

I have an application which has following application properties files either in the working directory of the application (file:) or in the Maven's src/main/resources directory (classpath:):

  • file: application.properties:
    spring.profiles.include=LOCAL,DEV
  • file: application-DEV.properties
  • classpath: application-LOCAL.properties:
    spring.profiles.include=LOCAL-SPECIAL
  • classpath: application-DEV.properties:
    spring.profiles.include=DEV-SPECIAL
  • classpath: application-LOCAL-SPECIAL.properties

After running application main class from Eclipse with such configuration I see that LOCAL, DEV, LOCAL-SPECIAL, DEV-SPECIAL profiles are active as expected.

What is not ok is the order in which those files are loaded.

In Spring Boot 2.0.2 the order of files (from the least significant) is:

  • file: application.properties:
  • classpath: application-LOCAL.properties
  • classpath: application-DEV.properties
  • file: application-DEV.properties
  • classpath: application-LOCAL-SPECIAL.properties

In Spring Boot 1.5.10 it was:

  • file: application.properties:
  • classpath: application-LOCAL.properties
  • classpath: application-DEV.properties
  • classpath: application-LOCAL-SPECIAL.properties
  • file: application-DEV.properties

As the documentation for externalized configuration mentions that profile-specific application properties outside of your packaged jar (file: in my case) should have higher precedence over profile-specific application properties packaged inside your jar (classpath: in my case) this seems for me to be a bug in Spring Boot 2.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label May 30, 2018
@wilkinsona
Copy link
Member

Duplicate of #13151.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: duplicate A duplicate of another issue
Projects
None yet
Development

No branches or pull requests

3 participants