报错信息
org.apache.ibatis.exceptions.PersistenceException:
Error building SqlSession.
The error may exist in mapper/xml/UsersMapper.xml
Cause: org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper Configuration. Cause: java.io.IOException: Could not find resource mapper/xml/UsersMapper.xml
报错原因:在idea中不能编译src/main/java包下是xml文件
解决办法:在pom文件中进行配置使idea可以进行编译src/main/java包下的xml文件
在pom文件中配置
<build>
<!-- 配置idea可以编辑src/main/java下的xml文件 -->
<resources>
<resource>
<directory>src/main/java</directory>
<includes>
<include>*/**/*.xml</include>
</includes>
<filtering>true</filtering>
</resource>
</resources>
</build>
问题解决,运行成功