报这种错就是pom
依赖错误。
也就是说spring boot 的版本和 spring 的版本冲突。
所有我就换了版本
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.1.RELEASE</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<version>2.0.1.RELEASE</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>2.0.1</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>5.0.5.RELEASE</version>
<scope>compile</scope>
</dependency>
反正就是2.0.1 对应5.0.5
***************************
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:/software/repository/org/springframework/spring-beans/5.0.13.RELEASE/spring-beans-5.0.13.RELEASE.jar!/org/springframework/beans/factory/annotation/AnnotatedBeanDefinition.class
It was loaded from the following location:
file:/D:/software/repository/org/springframework/spring-beans/5.0.13.RELEASE/spring-beans-5.0.13.RELEASE.jar
Action:
Correct the classpath of your application so that it contains a single, compatible version of org.springframework.beans.factory.annotation.AnnotatedBeanDefinition
Disconnected from the target VM, address: '127.0.0.1:49508', transport: 'socket'
Process finished with exit code 1
这种就说明需要