We have a deployment env which use to/uses -spring.config.location=app.properties
property to provide the config location. Like mentioned in this post & this one github-br I wasn't aware that for my current springboot version i.e. 2.2.5.RELEASE
the properties behavior has changed. As expected we had to use spring.config.additional-location
so that it picks the default values from the jar as well.
The problem is however that for another application in the same 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 which the other app has and our app doesnt?
I don't know what code example to give as I don't know what code is causing the behavior to revert to old version. However here are some differences between the implementations of the 2 apps that I could see:
@PropertySource(value = "classpath:application.properties")
These are some the differences I could spot as of now. However not sure what causes this behavior change, please help.
I suspect that it's the use of @PropertySource
that is causing the difference in behaviour. @PropertySource("classpath:application.properties")
will load the properties from the first application.properties
resource found on the classpath, irrespective of how spring.config.location
and spring.config.additional-location
have been configured.