报错日志是这样的

***************************
APPLICATION FAILED TO START
***************************

Description:

An attempt was made to call a method that does not exist. The attempt was made from the following location:

    org.springframework.context.annotation.AnnotationConfigUtils.processCommonDefinitionAnnotations(AnnotationConfigUtils.java:259)

The following method did not exist:

    org.springframework.beans.factory.annotation.AnnotatedBeanDefinition.setRole(I)V

The method's class, org.springframework.beans.factory.annotation.AnnotatedBeanDefinition, is available from the following locations:

    jar:file:/D:/Java/maven/gao_repository/repository/org/springframework/spring-beans/5.0.9.RELEASE/spring-beans-5.0.9.RELEASE.jar!/org/springframework/beans/factory/annotation/AnnotatedBeanDefinition.class
    jar:file:/D:/Java/maven/gao_repository/repository/org/apache/activemq/activemq-all/5.14.0/activemq-all-5.14.0.jar!/org/springframework/beans/factory/annotation/AnnotatedBeanDefinition.class

It was loaded from the following location:

    file:/D:/Java/maven/gao_repository/repository/org/springframework/spring-beans/5.0.9.RELEASE/spring-beans-5.0.9.RELEASE.jar


Action:

Correct the classpath of your application so that it contains a single, compatible version of org.springframework.beans.factory.annotation.AnnotatedBeanDefinition
说明:

试图调用不存在的方法。尝试从以下位置进行:
org.springframework.context.annotation.AnnotationConfigUtils.processCommonDefinitionAnnotations(AnnotationConfigUtils.java:259)

以下方法不存在:
org.springframework.beans.factory.annotation.AnnotatedBeanDefinition.setRole(I)V

方法的类org.springframework.beans.factory.annotation.AnnotatedBeanDefinition可从以下位置获得:

jar:file:/D:/Java/maven/gaou repository/repository/org/springframework/spring beans/5.0.9.RELEASE/spring-beans-5.0.9.RELEASE.jar!/org/springframework/beans/factory/annotation/AnnotatedBeanDefinition.class

jar:file:/D:/Java/maven/gaoúu repository/repository/org/apache/activemq/activemq all/5.14.0/activemq-all-5.14.0.jar!/org/springframework/beans/factory/annotation/AnnotatedBeanDefinition.class

它是从以下位置加载的:
文件:/D:/Java/maven/gaoúu repository/repository/org/springframework/spring beans/5.0.9.RELEASE/spring-beans-5.0.9.RELEASE.jar

行动:
更正应用程序的类路径,使其包含org.springframework.beans.factory.annotation.AnnotatedBeanDefinition的单一兼容版本

解决思路

  • 我在网上找,有网友说要删除这个jar,我信了…结果,删完程序直接出错了,可想而知我这里不是这个问题。

注意: 是jar冲突的问题,因为springboot内置了activemq,只有这两个其中一个即可

  • 看一下你的pom依赖图

  • 看你pom文件引入的依赖

  • 然后我尝试将spring-boot-starter删除

  • 再启动,解决

Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐