使用IDEA 创建 Mybites 时出现org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)

使用IDEA创建Mybites时出现org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)

在第一次使用IDEA创建SSM项目中,测试的时候出现org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)
错误信息
错误如图所示,我一直在查找问题
最开始,我认为自己的配置文件写错了,从配置文件中查找错误,但是结果发现并没有发现错误
查找了好长时间,但是都没有发现那里有错误,于是乎,只能在网上寻求帮助,在网上看到的最多的就是
网上的解决方法
我按照这些解决方法,一个个的试试,结果并没有解决我的问题
结果我又看到其他的解决方法,就是XML没有编译到文件中

  • 这是我的包结构
    包结构

  • 编译之后
    编译之后

确实是在编译之后mapper的映射文件没有编译到项目中去,在网上,网友要给出了两个解决方案

1、把*Mapper.xml文件放到resource文件夹下管理

2、pom配置一下编译xml文件

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

亲试可以

猜你喜欢

转载自blog.csdn.net/qq_35133320/article/details/80785693