IDEA org.apache.ibatis.binding.BindingException: Invalid bound statement (not found):
引用地址:https://guozh.net/idea-org-apache-ibatis-binding-bindingexception-invalid-bound-statement-not-found/ 这位大哥写的很详细,就拿过来用了
IDEA org.apache.ibatis.binding.BindingException: Invalid bound statement (not found):
前言
在使用 IDEA 当作工具使用 Mybatis+Spring 时,总是能碰到 Eclipse 碰不到的“蛋疼问题”,这应该是属于 IDEA 的阵痛期,这个错我已经碰到4次了,而且每次原因还不太同。久病成良医,下一次应该不会再出现了,记录下解决办法,希望能帮到你,因为我已经在这个问题上浪费太多时间了。
情况
Mybatis+Spring 配置有好几种方法。最常用的应该是 Mapper 动态代理开发,但是动态代理配置也有两种。
<!-- Mapper代理的方式开发方式一,配置Mapper代理对象 -->
<bean id="userMapper" class="org.mybatis.spring.mapper.MapperFactoryBean">
<!-- 配置Mapper接口 -->
<property name="mapperInterface" value="cn.itcast.mybatis.mapper.UserMapper" />
<!-- 配置sqlSessionFactory -->
<property name="sqlSessionFactory" ref="sqlSessionFactory" />
</bean>
<!-- Mapper动态代理开发 开发方式2 扫描 -->
<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
<property name="basePackage" value="com.guozh.bitbooks.mapper" />
<property name="sqlSessionFactoryBeanName" value="sqlSessionFactory"/>
</bean>
一般使用第二种,本人也是使用第二种。如果第二种 首先有几点要确定。
- *Mapper.java 和 *Mapper.xml 命名是否一致
- 是否在一个包下,扫描能不能扫到 .xml。
- *Mapper.xml 的 namespace 配置是否准确,接口方法名是否准确。
以上都是 mybatis 的基本知识,当然第二点 可以不再同一个包下。很多种写法,可能有人喜欢将 *Mapper.xml 放在 resources 下。无所谓,只要能扫描到就可以了。
ok 到这里如果还报错如上错误,和我一样,接着看吧
解决
- 删除编辑后的文件 class,然后
Rebuild在运行。 - 如果上面方法不行,仔细找找在编译后的classes 中 *Mapper.xml 生成了没,如果没 那一定有问题。

我的项目结构是这样的,并且 *Mapper.xml 放在 java 中。这里就会有一个问题。
idea默认是不编译 src\main\java下的xml文件
所以这就需要我们手动配置下。
- 将 *Mapper.xml 复制一份到 resources 下,记得修改 mybatis 配置文件的路径。
- 在 pom.xml 中配置资源代码
<build>
<resources>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.xml</include>
</includes>
</resource>
</resources>
</build>
ok 希望能帮到你。
IDEA org.apache.ibatis.binding.BindingException: Invalid bound statement (not found):的更多相关文章
- org.apache.ibatis.binding.BindingException: Invalid bound statement (not found):
org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): da.huying.usermanag ...
- Exception:HTTP Status 500 - org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)
主要错误信息如下: HTTP Status 500 - org.apache.ibatis.binding.BindingException: Invalid bound statement (not ...
- mybatis使用时org.apache.ibatis.binding.BindingException: Invalid bound statement (not found):的错误
最近在使用mybatis时,出现了 org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): 这 ...
- IDEA异常解决: org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)
有时候解决问题不仅仅是解决问题.-----jstarseven 最近因为开发需要,需要搭建一个ssm开发框架,采用了开发工具IDEA. 整合完了SSM开发框架之后,发布的时候出现org.apache. ...
- 通过maven test 报org.apache.ibatis.binding.BindingException: Invalid bound statement
背景 直接使用eclipse工具去执行,没有问题,通过testng.xml去执行,没有问题,但通过mvn clean test执行,就报错,提示org.apache.ibatis.binding.Bi ...
- org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): cn.e3mall.search.mapper.ItemMapper.getItemList
java.lang.RuntimeException: org.apache.ibatis.binding.BindingException: Invalid bound statement (not ...
- Java学习-052-(mybatis+mysql)访问接口时提示:org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)
在配置mybatis,访问接口提示: org.apache.ibatis.binding.BindingException: Invalid bound statement (not found),部 ...
- org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.shen.mapper.UserMapper.findById
org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.shen.mapper.Use ...
- MyBatis笔记----报错Exception in thread "main" org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.ij34.model.UserMapper.selectUser
信息: Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@41cf53f9: startup ...
- MyBatis笔记----报错:Exception in thread "main" org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)解决方法
报错 Exception in thread "main" org.apache.ibatis.binding.BindingException: Invalid bound st ...
随机推荐
- BASH Shell 文件管理
BASH Shell 对文件进行管理 ========================================================创建.复制.删除.移动.查看.编辑.压缩.查找 内 ...
- gitlab如何从Github导入项目
本文简单演示如何Github上导入项目到私人搭建的Gitlab中,搭建过程参考:CentOS7 搭建gitlab服务器. Gitlab版本是gitlab-ce-12.0.2,界面可能稍有差异,但应该影 ...
- 5.java基础之static、类加载过程
static修饰符 修饰属性:静态的属性不属于任何对象,全类及其对象共用,可以用类名直接调用 修饰方法:静态的方法可以直接用类名调用,和对象无关.静态方法只能访问静态成员和静态方法,非静态方法可以调用 ...
- DevExpress Applications<3>
Project Template Project Template Information Template Name Template Description Controls and Compon ...
- [转]BEC Vantage
https://www.examenglish.com/BEC/BEC_Vantage.html https://www.cambridgeenglish.org/exams-and-tests/bu ...
- JWT基础知识
1> JWT定义 JSON Web Token (JWT) 是一种开放的行业标准(RFC 7519),用于安全传送认证信息. 是目前流行的跨域认证的解决方案. 2> JWT数据结构 由三部 ...
- iOS中dealloc原理
参考链接: https://www.jianshu.com/p/eec3fb94b2e6
- 详解Python函数参数定义及传参(必备参数、关键字参数、默认可省略参数、可变不定长参数、*args、**kwargs)
详解Python函数参数定义及传参(必备参数.关键字参数.默认可省略参数.可变不定长参数.*args.**kwargs) Python函数参数传参的种类 Python中函数参数定义及调用函数时传参 ...
- Redis中的Scan命令的使用
Redis中有一个经典的问题,在巨大的数据量的情况下,做类似于查找符合某种规则的Key的信息,这里就有两种方式,一是keys命令,简单粗暴,由于Redis单线程这一特性,keys命令是以阻塞的方式执行 ...
- Data Guard Physical Standby - RAC Primary to RAC Standby 使用第二个网络 (Doc ID 1349977.1)
Data Guard Physical Standby - RAC Primary to RAC Standby using a second network (Doc ID 1349977.1) A ...