spring-cloud / spring-cloud-vault

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

Build error for Spring 2.4.1 with spring-cloud-starter-vault-config 2.2.4.RELEASE #558

Closed pxb280 closed 3 years ago

pxb280 commented 3 years ago

I have upgraded spring boot dependencies from 2.3.5.RELEASE to 2.4.1. I have spring-cloud-starter-vault-config version at 2.2.4.RELEASE. I tried to upgrade it to 2.2.6.RELEASE. In both the cases I am getting below error.

java.lang.IllegalStateException: Failed to load ApplicationContext Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'configurationPropertiesBeans' defined in class path resource [org/springframework/cloud/autoconfigure/ConfigurationPropertiesRebinderAutoConfiguration.class]: Post-processing of merged bean definition failed; nested exception is java.lang.IllegalStateException: Failed to introspect Class [org.springframework.cloud.context.properties.ConfigurationPropertiesBeans] from ClassLoader [jdk.internal.loader.ClassLoaders$AppClassLoader@2aae9190] Caused by: java.lang.IllegalStateException: Failed to introspect Class [org.springframework.cloud.context.properties.ConfigurationPropertiesBeans] from ClassLoader [jdk.internal.loader.ClassLoaders$AppClassLoader@2aae9190] Caused by: java.lang.NoClassDefFoundError: org/springframework/boot/context/properties/ConfigurationBeanFactoryMetadata Caused by: java.lang.ClassNotFoundException: org.springframework.boot.context.properties.ConfigurationBeanFactoryMetadata

Is there any compatible version of spring-cloud-starter-vault-config? I tried spring-cloud-starter-vault-config version 3.0.0-RC1. It throws error as below. In my project I have bootstrap.yml with property spring.cloud.vault.token which is not empty. Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.vault.authentication.VaultTokenSupplier]: Factory method 'vaultTokenSupplier' threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'clientAuthentication' defined in class path resource [org/springframework/cloud/vault/config/VaultAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.vault.authentication.ClientAuthentication]: Factory method 'clientAuthentication' threw exception; nested exception is java.lang.IllegalArgumentException: Token (spring.cloud.vault.token) must not be empty

spencergibb commented 3 years ago

Version 2.x of Spring Cloud vault is not compatible with boot 2.4.x so only the later error is relevant

spencergibb commented 3 years ago

https://github.com/spring-cloud/spring-cloud-release/wiki/Spring-Cloud-2020.0-Release-Notes#breaking-changes

pxb280 commented 3 years ago

Version 2.x of Spring Cloud vault is not compatible with boot 2.4.x so only the later error is relevant

sorry, which error is relevant? I tried 2.4.1 with 3.0.0-RC1 spring-cloud-starter-vault-config. To fix bootstrap.yml issue. I added spring-cloud-starter-bootstrap dependency. Is this approach right? or I should not use 2.4.1 springboot? **

org.springframework.cloud
<artifactId>spring-cloud-starter-bootstrap</artifactId>

**

spencergibb commented 3 years ago

| which error is relevant? The error with 3.0.0-RC1

There are two approaches, add the bootstrap start like you said or use the new spring.config.import

pxb280 commented 3 years ago

ok great. I have added bootstrap dependency. It is working. Thank you

erickjhorman commented 3 years ago

Hi i got the same issue so what i did was to use 2.4.3 spring framework and not tell maven the version of spring cloud in properties but i had to tell the version of some dependencies that maven required when i run the project