Spring boot Spring云流-以下方法不存在
目前,我们正在尝试制作一个SCS应用程序,该应用程序会向某个主题生成某些消息,但是在运行该应用程序时,我们遇到了以下错误:Spring boot Spring云流-以下方法不存在,spring-boot,gradle,apache-kafka,spring-cloud-stream,Spring Boot,Gradle,Apache Kafka,Spring Cloud Stream,目前,我们正在尝试制作一个SCS应用程序,该应用程序会向某个主题生成某些消息,但是在运行该应用程序时,我们遇到了以下错误: The following method did not exist: org.springframework.kafka.core.DefaultKafkaProducerFactory.setBeanName(Ljava/lang/String;)V The method's class, org.springframework.kafka.core.Def
The following method did not exist:
org.springframework.kafka.core.DefaultKafkaProducerFactory.setBeanName(Ljava/lang/String;)V
The method's class, org.springframework.kafka.core.DefaultKafkaProducerFactory, is available from the following locations:
jar:file:/C:/Users/Me/.gradle/caches/modules-2/files-2.1/org.springframework.kafka/spring-kafka/2.3.4.RELEASE/65f92192fc57991d4b135c715be5a506b3153ea1/spring-kafka-2.3.4.RELEASE.jar!/org/springframework/kafka/core/DefaultKafkaProducerFactory.class
It was loaded from the following location:
file:/C:/Users/Me/.gradle/caches/modules-2/files-2.1/org.springframework.kafka/spring-kafka/2.3.4.RELEASE/65f92192fc57991d4b135c715be5a506b3153ea1/spring-kafka-2.3.4.RELEASE.jar
Action:
Correct the classpath of your application so that it contains a single, compatible version of org.springframework.kafka.core.DefaultKafkaProducerFactory
我们认为spring boot和SCS存在兼容性问题。我们正在使用spring boot版本:2.2.2-RELEASE他已将我们的SCS版本更改为Hoxton 2并返回到Hoxton 6,还尝试更改我们的spring kafka版本控制,使其包含方法setBeanName。在更改spring kafka版本时,我们使用不同的方法遇到了类似的错误。以下是我的gradle依赖项:
implementation 'org.springframework.boot:spring-boot-starter-actuator'
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.cloud:spring-cloud-stream'
implementation 'org.springframework.cloud:spring-cloud-stream-binder-kafka'
implementation 'org.springframework.kafka:spring-kafka'
implementation 'org.springframework.boot:spring-boot-starter-validation'
implementation 'com.fasterxml.jackson.dataformat:jackson-dataformat-xml'
以下是依赖关系管理:
dependencyManagement {
imports {
mavenBom "org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}"
}
问题是(我们认为)spring kafka正在从其他地方被拉进来,并默认为2.3.4.RELEASE,它不包含setBeanName
对此有何想法?您需要将应用程序中的spring kafka依赖项更新为
2.3.10.BUILD-SNAPSHOT
,以解决此问题。明天(2020年7月22日),它将发布(2.3.10.RELEASE
),它将由Spring Boot2.2.9.RELEASE
(计划于2020年7月23日发布)。因此,当启动版本可用时,您应该更新应用程序以使用该版本(2.2.9.REELASE
)。我们可以通过切换到Spring Boot 2.3.1.release来缓解问题。如果我们无法更新Spring Boot,您是否知道还有其他解决方法?