1.查看**mapper.xml文件的空间包名和类名有没有错
2.SpringBoot加载了**mapper.xml文件
3.确保Maven加载了mybatis相关的maven
4.启动类上加载相应的扫描包
5.如果mapper.xml被Maven给拦截了,会导致加载不上,从而无法实例化sqlSessionFactory,这时需要配置放行
<build>
<!-- 添加资源 -->
<resources>
<resource>
<directory>src/main/resources</directory>
<!-- src/main/resources下的指定资源放行 -->
<includes>
<include>**/*.properties</include>
<include>**/*.yml</include>
<include>**/*.xml</include>
</includes>
<filtering>false</filtering>
</resource>
</resources>
</build>