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包有沖突,解決沖突


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM