idea出现无法自动映射Mapper错误 BindingException: Invalid bound statement (not found)

版权声明:随便转吧,反正我也是转的 https://blog.csdn.net/qq_34122822/article/details/79258809

使用IDEA开发项目时,报出这个错误org.apache.ibatis.binding.BindingException: Invalid bound statement (not found),这个错误一般是包名、namespace对不上,但我仔细检查后并没有问题。

原因是mapper.xml没有放在资源文件夹中,在编译的时候 idea不会将诸如.xml文件编译到classes下面,应该要告诉IDEEA将mapper.xml文件编译到classes文件中。请在pom.xml 的<build>中加入如下代码:

<resources>
  <resource>
    <directory>src/main/java</directory>
    <excludes>
      <exclude>**/*.java</exclude>
    </excludes>
  </resource>
  <resource>
    <directory>src/main/resources</directory>
    <includes>
      <include>**/*.* </include>
    </includes>
  </resource>
</resources>

猜你喜欢

转载自blog.csdn.net/qq_34122822/article/details/79258809