整合SSM项目中出现org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)解决方案
一、出现的异常
在运行过程中,一直出现
org.apache.ibatis.binding.BindingException: Invalid bound statement (not found):com.spring.dao.user.UserMapper.getLoginUser

排查UserMapper和UserMapper.xml是否有命名不一致的情况


排查配置文件的情况

IDE内一切正常,就是运行失败。
二、错误原因
UserMapper.xml放在dao.user包下未编译,导致编译器内一切正常,运行失败。

三、解决方案
3.1方法一
把UserMapper.xml放到资源根目录resource/Mapper下,运行后成功编译

3.2方法二
配置一下pom.xml
<build>
<resources>
<resource>
<filtering>false</filtering>
<directory>src/main/java</directory>
<includes>
<include>**/*.xml</include>
</includes>
</resource>
</resources>
</build>
运行后,成功编译

问题解决


浙公网安备 33010602011771号