spring-cloud-vault icon indicating copy to clipboard operation
spring-cloud-vault copied to clipboard

Config Server + Config Vault + Actuator = two beans with the same name

Open marcingrzejszczak opened this issue 1 year ago • 4 comments

When we have

spring-cloud-config-server, spring-cloud-starter-vault-config and starter-actuator on the classpath we get the issue that the bean vaultTemplate is defined in SpringVaultClientConfiguration and in VaultAutoConfiguration. The application will not start unless we provide bean overriding.

It's enough to rename one of those beans to fix this.

marcingrzejszczak avatar Dec 18 '24 14:12 marcingrzejszczak

I see vaultTemplate defined here https://github.com/spring-cloud/spring-cloud-vault/blob/main/spring-cloud-vault-config/src/main/java/org/springframework/cloud/vault/config/VaultAutoConfiguration.java#L158

But SpringVaultClientConfiguration does not have any beans defined in it. I searched spring cloud config for anything named vaultTemplate but I did not find any beans with that name.

ryanjbaxter avatar Dec 18 '24 16:12 ryanjbaxter

SpringVaultClientConfiguration extends AbstractVaultConfiguration. vaultTemplate is defined here.

The second one is indeed here.

marcingrzejszczak avatar Dec 19 '24 08:12 marcingrzejszczak

But these are in Spring Vault Core and Spring Cloud Vault, so shouldn't the problem be resolved in one of those projects?

ryanjbaxter avatar Dec 19 '24 14:12 ryanjbaxter

That's a very valid point ;) Let's transfer this to Spring Cloud Vault.

marcingrzejszczak avatar Dec 19 '24 15:12 marcingrzejszczak