Issue
I have a spring boot application which reads properties from a remote config server via spring cloud, and it works fine with different configuration files defined in the remote repository, i'm running it with following command :
java -jar my-app.jar --spring.profiles.active=my-custom-profile
However, in some special cases i would want to be able to run the application while changing some of the remote properties (these changes are not fixed, so i can't create some custom profiles for them), so i've tried to override them directly via the command line this way :
java -jar my-app.jar --spring.profiles.active=my-custom-profile --my.first.property=value1 --my.second.property=value2
But it doesn't seem to be taken into consideration, because the application still takes the remote properties on startup.
Is there any proper way to achieve that ?
Solution
Remote properties defined by Spring Cloud Config take precedence over any other property sources. If you want to override those with local properties, you need to explicitly allow this as described in Overriding the Values of Remote Properties:
spring.cloud.config.allowOverride=true
spring.cloud.config.overrideNone=true
Answered By - Gregor Zurowski