- 错误分析
很明显是Could not find resource com/xxx/xxx/Xxx.xml的错误。本人使用的是idea编译器,在idea中是不会编译src的java目录的xml文件,所以在Mybatis的配置文件中找不到xml文件!(也有可能是Maven构建项目的问题)。 - 解决方式:在pom.xml中加入这个东西):
<build>
<resources>
<!-- resources文件 -->
<resource>
<directory>src/main/java</directory>
<!-- 引入映射文件等 -->
<includes>
<include>**/*.xml</include>
</includes>
</resource>
</resources>
</build>
- 重新clean compile编译打包,问题解决