Spring junit 测试报错:Failed to load ApplicationContext
Spring junit测试:Failed to load ApplicationContext解决思路
错误代码如下:
检查以下几项
1、版本依赖冲突
<!--错误原因-->
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>3.0.0</version>
</dependency>
注:选择与springboot版本符合的依赖
我找了大半天才发现是版本冲突,springboot版本2.5.2,mybatis版本为3.0.0导致的报错,将mybatis版本改为2.1.0后成功解决