报错信息: Caused by: java.lang.IllegalArgumentException: Property 'sqlSessionFactory' or 'sqlSessionTemplate' are required
1 导入mybatis-spring-boot-starter-test
依赖
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter-test</artifactId>
<version>1.3.2</version>
<scope>test</scope>
</dependency>
2 检查pom.xml
配置的数据库版本与实际数据库版本是否一致,无用
3 降低spring-boot-starter-parent
版本,删除maven仓库里面的jar包,重新导入
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<!-- <version>2.2.2.RELEASE</version>-->
<version>2.0.1.RELEASE</version>
<relativePath/>
</parent>
4 确认是否存在数据库连接池的包
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid-spring-boot-starter</artifactId>
<version>1.1.21</version>
</dependency>
5 是否是本地仓库的jar冲突,删除所有jar包,重新下载
6 查看启动类是否有 @SpringBootApplication(exclude = DataSourceAutoConfiguration.class)
, 有则删除