spring-cloud / spring-cloud-release

Spring Cloud Release Train - dependency management across a wide range of Spring Cloud projects.
http://projects.spring.io/spring-cloud
Apache License 2.0
874 stars 179 forks source link

Spring Cloud 3.0.2+ is not compatible with Spring Boot 2.4.2 #237

Closed scutaru closed 2 years ago

scutaru commented 2 years ago

If we use the above versions, we get the following exception:

17:00:24.235 [main] ERROR org.springframework.boot.SpringApplication - Application run failed
java.lang.IllegalArgumentException: Unable to instantiate org.springframework.boot.context.config.ConfigDataLoader [org.springframework.cloud.vault.config.VaultConfigDataLoader]
                at org.springframework.boot.util.Instantiator.instantiate(Instantiator.java:103)
                at org.springframework.boot.util.Instantiator.instantiate(Instantiator.java:90)
                at org.springframework.boot.context.config.ConfigDataLoaders.<init>(ConfigDataLoaders.java:75)
                at org.springframework.boot.context.config.ConfigDataLoaders.<init>(ConfigDataLoaders.java:56)
                at org.springframework.boot.context.config.ConfigDataEnvironment.<init>(ConfigDataEnvironment.java:155)
                at org.springframework.boot.context.config.ConfigDataEnvironmentPostProcessor.getConfigDataEnvironment(ConfigDataEnvironmentPostProcessor.java:108)
                at org.springframework.boot.context.config.ConfigDataEnvironmentPostProcessor.postProcessEnvironment(ConfigDataEnvironmentPostProcessor.java:97)
                at org.springframework.boot.context.config.ConfigDataEnvironmentPostProcessor.postProcessEnvironment(ConfigDataEnvironmentPostProcessor.java:89)
                at org.springframework.boot.env.EnvironmentPostProcessorApplicationListener.onApplicationEnvironmentPreparedEvent(EnvironmentPostProcessorApplicationListener.java:100)
                at org.springframework.boot.env.EnvironmentPostProcessorApplicationListener.onApplicationEvent(EnvironmentPostProcessorApplicationListener.java:86)
                at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:176)
                at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:169)
                at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:143)
                at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:131)
                at org.springframework.boot.context.event.EventPublishingRunListener.environmentPrepared(EventPublishingRunListener.java:82)
                at org.springframework.boot.SpringApplicationRunListeners.lambda$environmentPrepared$2(SpringApplicationRunListeners.java:63)
                at java.util.ArrayList.forEach(ArrayList.java:1249)
                at org.springframework.boot.SpringApplicationRunListeners.doWithListeners(SpringApplicationRunListeners.java:117)
                at org.springframework.boot.SpringApplicationRunListeners.doWithListeners(SpringApplicationRunListeners.java:111)
                at org.springframework.boot.SpringApplicationRunListeners.environmentPrepared(SpringApplicationRunListeners.java:62)
                at org.springframework.boot.SpringApplication.prepareEnvironment(SpringApplication.java:362)
                at org.springframework.boot.SpringApplication.run(SpringApplication.java:320)
                at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:144)
                at com.example.ExampleServApplication.main(ExampleServApplication.java:29)
Caused by: java.lang.IllegalAccessException: Unable to find suitable constructor
                at org.springframework.boot.util.Instantiator.instantiate(Instantiator.java:118)
                at org.springframework.boot.util.Instantiator.instantiate(Instantiator.java:100)
                ... 23 common frames omitted

It seems that these particular set of versions is incompatible (even though the release train says otherwise):

The problem is that the class ConfigDataLoaders supports DeferredLogFactory injection only in spring-boot 2.4.3:

https://github.com/spring-projects/spring-boot/commit/1def245a2cb7f5aa520531059956c3c3794625d7

On the other hand, starting with Spring Cloud 3.0.2, VaultConfigDataLoader has a new constructor accepting a DeferredLogFactory:

https://github.com/spring-cloud/spring-cloud-vault/commit/a9fd88c3b768a1f6e485851423dd8f62afae71ba

So, either use Spring Boot 2.4.2 and Spring Cloud 3.0.1 or lower or use Spring Boot 2.4.3 and Spring Cloud 3.0.2+.

I'm opening this bug because this kind of incompatibility should be clearly specified in the documentation (if it is already, probably it's not very easy to find :) )

spencergibb commented 2 years ago

I'll add something to the release notes