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 ...
随机推荐
- MSSQL - 最佳实践 - 使用SSL加密连接
MSSQL - 最佳实践 - 使用SSL加密连接 author: 风移 摘要 在SQL Server安全系列专题月报分享中,往期我们已经陆续分享了:如何使用对称密钥实现SQL Server列加密技术. ...
- Leetcode7 : Reverse Integer 整数反转问题
问题描述 Example1: x = 123, return 321 Example2: x = -123, return -321 原题链接: https://leetcode.com/proble ...
- 通过Ajax的访问zuul的跨域问题解决方案
刚开始在使用jqueryajax跨域请求zuul网关时,在后台发现一直拿不到前台请求的json数据,而前台也一直拿不到后台的响应数据.打开浏览器调试程序发现,本身ajax的POST请求统一都变成了op ...
- 微信支付 第三篇 微信调用H5页面进行支付
上一篇讲到拿到了 预支付交易标识 wx251xxxxxxxxxxxxxxxxxxxxxxxxxxxxx078700 第四步,是时候微信内H5调起支付了! 先准备网页端接口请求参数列表 微信文档中已经明 ...
- Python 标准类库-数字和数学模块之decimal使用简介
标准类库-数字和数学模块之decimal使用简介 by:授客 QQ:1033553122 例子 >>>from decimal import * >>>getcon ...
- js-函数的三种创建方式
1.声明式 function fn() { //do something } 2.函数表达式 let fn = function () { //do something } 3.构造函数 functi ...
- ICMP和重定向攻击
目录 ICMP数据报格式 smurf攻击 ICMP重定向攻击 基于libpcap的sniffer raw socket 定义包头 解析数据包 重定向 ICMP数据报格式 https://zhuanla ...
- 中小后台系统UI框架--EasyUI
后台开发人员不擅长前端UI界面,而小型软件公司没有专职美工岗位,开发人员只能借助开源UI框架,复用已有组件,完成用户操作界面.EasyUI是基于jQuery的UI插件集合体,可帮助开发者轻松构建网页. ...
- C#&.Net干货分享-构造QRCoderHelper生成二维码图片
不想说废话,直接源码拿去用... /// <summary> /// 二维码管理 /// </summary> public class QRCoderHel ...
- 用python暴力破解压缩文件并不是万能,至少这个场景我告诉你密码你用代码也破解不了
看到论坛上各种贴子写用python进行暴力破解的文章,于是自己也想去尝试一下,不试不知道,一试吓一跳,真的就像那句有名的”python由入门到放弃“,把论坛上别人的脚本全部自己敲一遍,运行不报错,但也 ...