org.apache.ibatis.binding.BindingException:Invalid bound statement错误

出现这种错误应该是mapper接口和xml配置文件没有在一个路径下导致的,可以去查看一下编译之后的文件夹,target/classes/.../mapper中查看mapper.class和mapper.xml是否在一起


解决方法:

第一种方法:在resource路径下重新复制一份xml文件

第二种方法:在pom.xml文件中添加

<!-- 如果不添加此节点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>


猜你喜欢

转载自blog.csdn.net/yamanda/article/details/80343444
今日推荐