Closed bwoods8 closed 3 years ago
VaultConfigDataLocationResolver.resolveProfileSpecific(…)
actually returns VaultConfigLocation
in the exactly specified order. Need to investigate why the order in which the property sources get added to Environment
have a reverse order.
Seems that Boot expects the list of config location in ascending order while we return the list in descending order. So flipping the list should do the trick.
I am using Spring Cloud Vault 3.0.0 and Spring Boot 2.4.2. I am noticing that the order of precedence seems to be not what I expected.
/secret/appname
has higher precedence over/secret/appname/profile
The configuration looks similar to this:
In vault using KV v2:
/secret/application
/secret/application/profile
/secret/appname
/secret/appname/profile
I used a simple hello world app from Spring Boot examples to use external configuration values. If I add
name=Mars
to/secret/appname/profile
I see "Mars" output. If I also placename=Earth
to/secret/appname
. I then see "Earth" now. I expect to see "Mars" as the profile should override the previous. If I removename=Earth
from/secret/appname
, I see "Mars" again.I get this expectation from:
https://docs.spring.io/spring-boot/docs/2.4.0-SNAPSHOT/reference/htmlsingle/#boot-features-external-config-files-profile-specific
If I am doing something wrong or my understanding is flawed, please let me know.
Thanks for all the hard work!