springboot项目下的Caused by: org.apache.ibatis.binding.BindingException: Invalid bound statement (not fo

Posted 代码中透露着杀气

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了springboot项目下的Caused by: org.apache.ibatis.binding.BindingException: Invalid bound statement (not fo相关的知识,希望对你有一定的参考价值。

今天遇到mybatis-puls的报错Caused by: org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)

排查方法如下:

1、mapper接口和mapper.xml是否在同一个包(package)下?名字是否一样(仅后缀不同)?

2、mapper.xml的命名空间(namespace)是否跟mapper接口的包名一致?

3、接口的方法名,与xml中的一条sql标签的id一致

4、配置文件中的配置

#mybatis
mybatis-plus:
mapper-locations: classpath:**/*Mapper.xml

5、如果你的项目是maven项目,请你在编译后,到接口所在目录看一看,很有可能是没有生产对应的xml文件,因为maven默认是不编译的,因此,你需要在你的pom.xml的<build></build>里面,加这么一段:

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

 

我的问题就出在第5部,因为之前没怎么接触maven项目,所以新建项目后并没有在pom中加上编译的配置,导致一直找不到绑定失败。今把问题记录方便日后好进行回忆查看

以上是关于springboot项目下的Caused by: org.apache.ibatis.binding.BindingException: Invalid bound statement (not fo的主要内容,如果未能解决你的问题,请参考以下文章

Caused by: java.io.FileNotFoundException: class path resource [com/cxy/springboot/mapping/] cannot b

SpringBoot 报错Caused by: org.apache.ibatis.type.TypeException: Could not resolve type alias ‘*****‘

SpringBoot 报错Caused by: org.apache.ibatis.type.TypeException: Could not resolve type alias ‘*****‘

异常Caused by: java.lang.IllegalStateException: Zip64 archives are not supported

Spring Boot集成Redis启动失败Caused by: java.lang.ClassNotFoundException: org.apache.commons.pool2.impl.G

Spring Boot集成Redis启动失败Caused by: java.lang.ClassNotFoundException: org.apache.commons.pool2.impl.G