我将Spring Boot 2.5.5
与Spring Cloud Version 2020.0.4
一起使用,但当我尝试运行应用程序时,出现以下异常-
Exception encountered during context initialization - cancelling refresh attempt:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name
'compositeCompatibilityVerifier' defined in class path resource [org/springframework
/cloud/configuration/CompatibilityVerifierAutoConfiguration.class]: Bean instantiation
via factory method failed; nested exception is
org.springframework.beans.BeanInstantiationException: Failed to instantiate
[org.springframework.cloud.configuration.CompositeCompatibilityVerifier]: Factory
method 'compositeCompatibilityVerifier' threw exception; nested exception is
org.springframework.cloud.configuration.CompatibilityNotMetException
pom.xml
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.5.5</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<properties>
<java.version>1.8</java.version>
<spring-cloud.version>2020.0.4</spring-cloud.version>
</properties>
<dependencies>
<!-- Below jar file also has same Spring Boot Version -->
<dependency>
<groupId>com.another.project</groupId>
<artifactId>commons</artifactId>
<version>1</version>
<scope>compile</scope>
</dependency>
<!-- other spring boot dependency -->
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>${spring-cloud.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
我有另一个项目jar
包含在pom
中,它也有相同的Spring Boot Version
,我怀疑导致问题,但不确定如何?
3条答案
按热度按时间lmvvr0a81#
你的
pom
看起来不错。我唯一的建议是检查Spring组件的兼容性。spring.io页面有一个兼容性矩阵,你应该仔细检查你试图使用的版本是否与 Spring Boot 兼容。你可以尝试的第二件事,是根本没有父POM,而是从它们的pom-s导入spring Boot 和spring cloud依赖项。
你加了Spring Cloud,为春 Boot 做了:
2w3rbyxf2#
当我使用spring-cloud时,我遇到了同样的问题。版本:2020.0.3并使用版本解决
<spring-cloud.version>2021.0.3</spring-cloud.version>
jtoj6r0c3#
检查您正在使用的spring-cloud与您的spring-boot版本的兼容性:Spring-Cloud