整合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

image-20241119162754609

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

image-20241119163029570

image-20241119163056556

排查配置文件的情况

image-20241119163236540

IDE内一切正常,就是运行失败。

二、错误原因

UserMapper.xml放在dao.user包下未编译,导致编译器内一切正常,运行失败。

image-20241119163336963

三、解决方案

3.1方法一

UserMapper.xml放到资源根目录resource/Mapper下,运行后成功编译

image-20241119163600222

3.2方法二

配置一下pom.xml

 <build>
        <resources>
            <resource>
                <filtering>false</filtering>
                <directory>src/main/java</directory>
                <includes>
                    <include>**/*.xml</include>
                </includes>
            </resource>
        </resources>
    </build>

运行后,成功编译
2024-11-19

问题解决

屏幕截图 2024-11-19 162315

posted @ 2024-11-19 16:53  Gu_diao  阅读(755)  评论(0)    收藏  举报