Context
trying to fetch secrets from Hashicorp Vault, instead of hardcoding in properties file
What I have tried
I am following Spring Vault docs
https://docs.spring.io/spring-vault/reference/vault/propertysource.html#_registering_vaultpropertysource
Where it says
VaultPropertySource has been added with highest precedence in the search. If it contains a ´foo` property, it will be detected and returned ahead of any foo property in any other PropertySource.
However, when used in conjunction with spring cloud vault KV backend, it trumps @VaultPropertySource
annotation from spring-vault-core
, and my springboot application starts with properties obtained by spring-cloud-vault
.
Evidence:
spring-cloud-vault config in application.yml
cloud:
vault:
enabled: true
kv:
enabled: true
backend: secret
application-name: receiver
authentication: token
# this is set in intelliJ run configuration > environment variable section
token: ${VAULT_TOKEN}
uri: http://127.0.0.1:8200
Below are screenshots from actuator/env
@VaultPropertySource
loaded values skipped
I am using spring Configuration and @VaultPropertySource
like below
@Configuration
@VaultPropertySource("receiver/db")
class VaultConfig() { ... }