Nye*_*ass 12 java spring maven spring-cloud openfeign
当我尝试运行 Spring Boot 应用程序时,出现此异常:
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@3764951d]
Run Code Online (Sandbox Code Playgroud)
我认为是版本不兼容。我在我的 pom.xml 中导入了 open feign,之后它不起作用,但我不知道如何解决这个问题。我使用 open feign 2.2.5.RELEASE。这是我的 pom.xml:
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@3764951d]
Run Code Online (Sandbox Code Playgroud)
use*_*049 18
我遇到了同样的问题,这是由于 Spring Cloud 服务和 Spring Boot 版本问题而发生的。我通过使用https://start.spring.io/生成我的项目摆脱了它。
选择项目所需的所有依赖项后,您可以单击“浏览”按钮并检查该pom.xml文件。
当我尝试在生成项目后添加依赖项时,发生了这个问题Eureka-client,pom.xml因此使用 IntelliJ。
我遇到了同样的错误。
然后我再次访问 Spring.io 选择我用于项目的依赖项以及 的依赖项Eureka-client,单击“浏览”按钮,看到我需要在 java 版本下添加这行代码pom.xml
<spring-cloud.version>2020.0.3</spring-cloud.version>
Run Code Online (Sandbox Code Playgroud)
但也有这一行:
<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>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<excludes>
<exclude>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>
Run Code Online (Sandbox Code Playgroud)
所以我只是将其复制粘贴到我现有的pom.xml并且它起作用了!
ash*_*bar 13
为了详细说明@M-deinum 的评论,将 Spring Boot 版本设置为2.3.4.RELEASE(而不是2.4.2我的情况)解决了这个问题。在gradle此意味着改变:
plugins {
id 'org.springframework.boot' version '2.4.2'
...
}
Run Code Online (Sandbox Code Playgroud)
到
plugins {
id 'org.springframework.boot' version '2.3.4.RELEASE'
...
}
Run Code Online (Sandbox Code Playgroud)
小智 12
Spring-Cloud - Hoxton.SR8 与 Spring-boot 2.4.0 不兼容
只需使用以下任一组合:
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.4.0</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<spring-cloud.version>2020.0.3</spring-cloud.version>
Run Code Online (Sandbox Code Playgroud)
或者
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.3.0</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<spring-cloud.version>Hoxton.SR8</spring-cloud.version>
Run Code Online (Sandbox Code Playgroud)
小智 9
您需要遵循Spring Cloud的发布链并匹配Spring-boot starter的版本。发布系列可在 spring-cloud 网站https://spring.io/projects/spring-cloud上找到
目前的发布列车是: Release train for spring-cloud
小智 8
所以这似乎是 SpringBoot 与云服务版本兼容性问题。有没有一点可以让我们看到整个 Spring 框架伞的版本兼容性矩阵?谢谢!
小智 6
您需要将 spring boot 版本更改为 Released 版本
从
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.4.0</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
Run Code Online (Sandbox Code Playgroud)
到
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.3.3.RELEASE</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
23543 次 |
| 最近记录: |