spring-cloud / spring-cloud-vault

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

PR for #459: Support multiple database secrets #587

Closed qbeukes closed 2 years ago

qbeukes commented 3 years ago

This implements a solution for https://github.com/spring-cloud/spring-cloud-vault/issues/459

Please advise if you would like me to do it differently.

pivotal-issuemaster commented 3 years ago

@qbeukes Please sign the Contributor License Agreement!

Click here to manually synchronize the status of this Pull Request.

See the FAQ for frequently asked questions.

pivotal-issuemaster commented 3 years ago

@qbeukes Thank you for signing the Contributor License Agreement!

bendem commented 3 years ago

This looks very interesting, what can be done to move it forward?

qbeukes commented 2 years ago

@mp911de Any comments on this PR? Are you happy with the approach of registering multiple database property beans in this @PostConstruct way?

mp911de commented 2 years ago

Thanks for the ping, I missed to follow up on this one. For framework components, we try to achieve as much as possible in the constructor or via InitializingBean. However, registering beans programmatically from a @Configuration class can cause all sorts of ordering issues. Specifically, I would advise to use the BeanFactoryPostProcessor hook.

Meanwhile, we also support Spring Boot's Config Data API (see VaultConfigDataLocationResolver). Using the Config Data API doesn't require bean registrations to register additional VaultSecretBackendDescriptors, it's just code within Spring Cloud Vault and probably easier than introducing multi-database support to the Bootstrap context. I'm actually wondering, whether we should introduce that feature only for the Config Data API.

mp911de commented 2 years ago

Thank you for your contribution. That's merged, polished, and backported now.