NoSuchMethodError: org.springframework.core.type.AnnotationMetadata.introspect

spring boot启动报错如下

java.lang.NoSuchMethodError: org.springframework.core.type.AnnotationMetadata.introspect(Ljava/lang/Class;)Lorg/springframework/core/type/AnnotationMetadata;
	at org.springframework.beans.factory.annotation.AnnotatedGenericBeanDefinition.(AnnotatedGenericBeanDefinition.java:58)
	at org.springframework.context.annotation.AnnotatedBeanDefinitionReader.doRegisterBean(AnnotatedBeanDefinitionReader.java:216)
	at org.springframework.context.annotation.AnnotatedBeanDefinitionReader.registerBean(AnnotatedBeanDefinitionReader.java:145)
	at org.springframework.context.annotation.AnnotatedBeanDefinitionReader.register(AnnotatedBeanDefinitionReader.java:135)
	at org.springframework.boot.BeanDefinitionLoader.load(BeanDefinitionLoader.java:158)

主要是包冲突,新引入依赖


    org.springframework.data
    spring-data-mongodb
    2.2.6.RELEASE

而且spring-boot-starter版本却是


    org.springframework.boot
    spring-boot-starter
    2.1.2.RELEASE

依赖的spring版本是


    org.springframework
    spring-core
    5.1.4.RELEASE


    org.springframework
    spring-bean
    5.1.4.RELEASE

而spring-data-mongodb依赖的版本是


    org.springframework
    spring-core
    5.2.0.RELEASE


    org.springframework
    spring-bean
    5.2.0.RELEASE

由于spring-boot-starter是内部强依赖,没招只能降版本

你可能感兴趣的:(java,Spring,java,spring,mongodb)