Spring-boot: spring.config.location completely replaces application.properties from the project

Created on 9 Nov 2017  路  8Comments  路  Source: spring-projects/spring-boot

Hi there. I was migrating from Spring Boot 1.5.4.RELEASE to 2.0.0.M6 and I notice that when I use:

--spring.config.location=app.properties

To specify other config file to overwrite some properties (production ones), it completely replaces the properties, "erasing" the default ones on the application.properties file. Is this intended behavior or a bug?

Thanks!

StackOverflow

invalid

Most helpful comment

Yes. From the release notes to which I linked above:

If you were relying on the way it was handled previously, you should now use spring.config.additional-location instead.

All 8 comments

@wilkinsona is there a way to use the same way as it was before?

Yes. From the release notes to which I linked above:

If you were relying on the way it was handled previously, you should now use spring.config.additional-location instead.

Ops my bad, I tried that before and got no results, tried now and it worked, must been a typo.

Thanks 馃槃

Is there any condition were --spring.config.location reverts to the old behavior?

@softKarma No, I don鈥檛 believe so.

We have a deployment env which uses this property to provide the config location. For our application it worked as expected and we had to use spring.config.additional-location so that it picks the defaults as well, however for another application in that env which has the same spring boot version i.e. 2.2.5.RELEASE spring.config.location is behaving the old way. So I am still wondering how that is happening for e.g. due to some other dependency.

@softKarma We can help you to figure that out, but this isn't the right place to do so. If you have any further questions, please follow up on Stack Overflow or Gitter. As mentioned in the guidelines for contributing, we prefer to use GitHub issues only for bugs and enhancements.

Was this page helpful?
0 / 5 - 0 ratings