Invalid bound statement (not found): com.taotao.mapper.TbItemMapper.selectByExample问题解决

最近在做一个关于ssm框架整合的项目,但是今天正合完后出现了问题:

 Invalid bound statement (not found): com.taotao.mapper.TbItemMapper.selectByExample

表示找不到mapper映射文件(xml)

解决办法:

  方法一、在mapper工程下的pom文件中加入下面的内容,让mapper映射文件加载到target的classes中去

<!-- 如果不添加此节点mybatis的mapper.xml文件都会被漏掉。 -->

      <build>

            <resources>

            <resource>

                <directory>src/main/java</directory>

                <includes>

                    <include>**/*.properties</include>

                    <include>**/*.xml</include>

                </includes>

                <filtering>false</filtering>

            </resource>

        </resources>

      </build>

如果pom文件中已经有build标签,只是把resources标签内部的内容拷贝进去,而build标签就不用了

若是没有就全部加进去

   方法二、如果还是没有解决,问题可能出现在扫描mapper.xml文件的配置上:

         不妨试着修改如下:

          修改前:

         

          修改后:

        

原文地址:https://www.cnblogs.com/rgever/p/9360314.html