I have a question regarding the priority of environment variables when working with spring cloud configuration server
In my service, I have a local application.yml properties file with this content
foo: bar: "some" buz: "some" joe: "some"
The service also connects to the configuration server with a configuration repository that contains the testservice-api.yml (where testservice-api is the name of the spring service application). The contents of this file are:
foo: bar: "some-specific"
Thus, with this configuration, the run-time configuration will result in the following:
{ "foo.bar": "some-specific", "foo.buz": "some", "foo.joe": "some" }
Now I am trying to override foo.bar and foo.joe environment variable.
So, I start the service with this command:
FOO_BAR=some-env FOO_JOE=some-env gradle bootRun
From what I read in this part of the spring boot documentation , environment variables should take precedence over configuration files - also spring cloud configuration documentation didn't specify sth differently - so I expect the result to be:
{ "foo.bar": "some-env", "foo.buz": "some", "foo.joe": "some-env" }
But instead, I get:
{ "foo.bar": "some-specific", "foo.buz": "some", "foo.joe": "some-env" }
Thus, only the configuration from the local configuration file inside the jar is overridden by the environment variable - the property from the configuration repo seems to take precedence over the environment variable.
Is this explainable - or is it a mistake? Any clues on this?
Here is the sample code here:
https://github.com/mduesterhoeft/configserver-test
The README in the repository lists the problem described here as Use Case 3