SpringBoot整合MyBatis出现找不到Mapper方法的异常 Invalid bound statement (not found): com.xh.xiaoyiduo.da

SpringBoot整合MyBatis出现找不到Mapper方法的异常
org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.xh.xiaoyiduo.dao.StudentDao.getStudent
我遇到过两次,总结如下:
一:
检查你的pom.xml是否配置了这段代码,没有的话需要加上!!!

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

    </build>

二、检查你Mapper的映射文件中的namespace全路径是否正确。

另外还需要注意resultType的全限定名,有别名就用别名,没有就用全路径!!!

我的问题出现在这里:
在这里插入图片描述

原定义的Mapper接口名称为:
在这里插入图片描述

修改后:
在这里插入图片描述

总结:编码时要细心点,长时间都没有解决的错误需要进行记录与总结,常见的错误尽量不要犯。


版权声明:本文为qq_39039017原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。