spring-cloud / spring-cloud-vault

Configuration Integration with HashiCorp Vault
http://cloud.spring.io/spring-cloud-vault/
Apache License 2.0
270 stars 151 forks source link

actuator/refresh path not updating @value variables when use spring cloud vault #635

Closed oguzhanonder91 closed 2 years ago

oguzhanonder91 commented 2 years ago

When I update a property in the vault and call actuator / refresh, it still shows an older value.

I use spring boot and spring cloud.

2020.0.3 2.5.3 https://stackoverflow.com/questions/69585905/actuator-refresh-path-not-updating-value-variables-when-use-spring-cloud-vault
mp911de commented 2 years ago

@Value is injected only once during component construction. Please either make your component @RefreshScoped or access the value through Environment.

oguzhanonder91 commented 2 years ago

Thanks for answer @mp911de . I added @RefreshScope to my configuration class but my properties not updated.

mp911de commented 2 years ago

The duplication with the StackOverflow post isn't ideal as there are easy-to-miss details. Your config is declared with renewal = VaultPropertySource.Renewal.RENEW. Please use renewal = VaultPropertySource.Renewal.ROTATE for rotation. Also, please note that only key-value secrets using the kv backend version 1 can be rotated if the Cache TTL expires. kv version 2 doesn't support cache TTLs.