我有一个pom.xml:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.3.12.RELEASE</version>
</parent>
<groupId>com.example</groupId>
<artifactId>example-app</artifactId>
<version>0.0.1-SNAPSHOT</version>
<properties>
<java.version>1.8</java.version>
<paho.version>1.2.5</paho.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-integration</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.integration</groupId>
<artifactId>spring-integration-jmx</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.integration</groupId>
<artifactId>spring-integration-mqtt</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.paho</groupId>
<artifactId>org.eclipse.paho.mqttv5.client</artifactId>
<version>${paho.version}</version>
</dependency>
</dependencies>
</project>我得到了一个错误:
Description:
An attempt was made to call a method that does not exist. The attempt was made from the following location:
org.springframework.integration.config.DefaultConfiguringBeanFactoryPostProcessor.registerErrorChannel(DefaultConfiguringBeanFactoryPostProcessor.java:210)
The following method did not exist:
'org.springframework.beans.factory.support.BeanDefinitionBuilder org.springframework.beans.factory.support.BeanDefinitionBuilder.rootBeanDefinition(java.lang.Class, java.util.function.Supplier)'
The method's class, org.springframework.beans.factory.support.BeanDefinitionBuilder, is available from the following locations:
jar:file:/Users/user/.m2/repository/org/springframework/spring-beans/5.2.15.RELEASE/spring-beans-5.2.15.RELEASE.jar!/org/springframework/beans/factory/support/BeanDefinitionBuilder.class
The class hierarchy was loaded from the following locations:
org.springframework.beans.factory.support.BeanDefinitionBuilder: file:/Users/user/.m2/repository/org/springframework/spring-beans/5.2.15.RELEASE/spring-beans-5.2.15.RELEASE.jar
Action:
Correct the classpath of your application so that it contains a single, compatible version of org.springframework.beans.factory.support.BeanDefinitionBuilder我真的不知道哪种版本的spring引导父版本和spring引导集成将使这一工作。
谢谢!
编辑:
我将pom.xml更改为使用spring的2.3.12.RELEASE版本,并删除了spring-integration-mqtt的version标记,但仍然存在相同的错误。
在执行mvn dependency:tree -Dincludes="org.springframework:spring-beans"时,我有下面的依赖树
[INFO] --- maven-dependency-plugin:3.1.2:tree (default-cli) @ example-app ---
[INFO] com.example:example-app:jar:0.0.1-SNAPSHOT
[INFO] \- org.springframework.boot:spring-boot-starter-web:jar:2.3.12.RELEASE:compile
[INFO] \- org.springframework:spring-web:jar:5.2.15.RELEASE:compile
[INFO] \- org.springframework:spring-beans:jar:5.2.15.RELEASE:compile发布于 2022-06-08 00:00:15
Spring版本的2.3.x暂时不支持了:https://spring.io/projects/spring-boot#support。
考虑选择最新版本并依靠Spring本身的依赖关系管理:不要对那些可以从Spring借用依赖项的依赖项使用显式版本。
无论如何,org.eclipse.paho.mqttv5.client将无法使用那个旧的Spring版本。您必须至少使用Spring 2.6.8来提取Spring 5.5.12。
https://stackoverflow.com/questions/72536165
复制相似问题