Cobra1117
Cobra1117

Reputation: 1402

Modify Spring Cloud Config precedence

How do you lower the precedence for Spring Cloud Config's property loader? I need to be able to override the properties via command line arguments, but that's currently not possible due to the Cloud Config property loader being highest precedence.

For example, if MyApp.jar is pulling the variable "foo=bar" from MyApp.yml in Cloud Config, I would like to be able to use this command:

java -jar MyApp.jar --foo=baz

Upvotes: 0

Views: 577

Answers (1)

spencergibb
spencergibb

Reputation: 25147

You can't currently override the precedence. But you can do something like this (in myapp.yml for example):

foo: ${fooOveride:bar}

Then you can do java -jar MyApp.jar --fooOveride=baz and then foo=baz.

Upvotes: 2

Related Questions