用idea使用mybatis时
<mappers>
<mapper resource="com/mybatis/mapper/UserMapper.xml"></mapper>
</mappers>
遇到吐下错误时
Error parsing SQL Mapper Configuration. Cause: java.io.IOException: Could not find resource com/mybatis/mapper/UserMapper.xml
如果文件路径没问题,可能是maven工程的问题,只能在resources中读取到xml文件,需要在pom.xml文件加上以下
<build>
<resources>
<!-- resources文件 -->
<resource>
<directory>src/main/java</directory>
<!-- 引入映射文件 -->
<includes>
<include>**/*.xml</include>
</includes>
</resource>
</resources>
</build>
标签:xml,Mapper,java,Cause,parsing,io,com,find
From: https://blog.51cto.com/u_15314615/6188078