SpringBoot项目启动报错An attempt was made to call a method that does not exist. 如何解决

***************************
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
出现这种情况一般都是jar包依赖问题(有可能
父子依赖版本不一致造成的),jar包冲突或者jar包的版本有问题,你可以这样操作
maven插件右击子项目,再点击 show dependenices,如下图,1查看冲突地方,2依赖图放大.
查看哪些jar包有冲突,解决冲突

posted @ 2021-12-04 09:35  LilLazy  阅读(4007)  评论(0编辑  收藏  举报