配置文件出错 org.apache.ibatis.binding.BindingException: Invalid bound statement (not found):
org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): <!-- mybatis 配置-->
<!--spring和mybatis完美结合,不需要mybatis配置映射文件-->
<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="dataSource" ref="dataSource" />
<!--mapperLocations:它表示我们的Mapper文件存放的位置,
当我们的Mapper文件跟对应的Mapper接口处于同一位置的时候可以不用指定该属性的值。
mapper文件就是xml文件-->
<!--自动扫描mapper.xml文件--> <property name="mapperLocations">
<array>
<value>classpath:mapper/country/*.xml</value>
<value>classpath:mapper/order/*.xml</value>
<value>classpath:mapper/product/*.xml</value>
<value>classpath:mapper/user/*.xml</value>
<value>classpath:mapper/BrandDao.xml</value>
</array>
</property>
<!--这个可以实现上面一样的功能-->
<!-- <property name="mapperLocations" value="classpath*:mapper/**/*.xml"/>-->
<!--这个query 一定研究一下 用处好大啊!!-->
<property name="typeAliasesPackage" value="cn.biye.core.bean,cn.biye.core.query"/>
</bean> <!-- 扫包 -->
<!-- DAO接口所在包名,Spring会自动查找其下的类 -->
<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
<!--下面这个value可以有两种写法:1,精确到各个包下面,多个包用逗号隔开。
2,不精确到每个包下面,就只写到各个包上面的包中,例如dao包下面还有包,则写到dao就行了-->
<property name="basePackage" value="cn.biye.core.dao.user,
cn.biye.core.dao.product,cn.biye.core.dao.order,cn.biye.core.dao.country"/>
<property name="sqlSessionFactoryBeanName" value="sqlSessionFactory"/>
</bean>
在这一点上面经常报错,可以肯定的是,把路径都详细指到位肯定是不会错的,但因为我赖得写全路径,所以就报莫名其妙的500,还写上一大堆参数未绑定,
无法注入bean也都是这个问题,,,最准确一点是报:在实现层找不到可以注入的dao can not autowire. No beans of 'FeatureDao" 其实也是它。
org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): 关于maven构建spring+Mybatis工程运行错误:
org.apache.ibatis.binding.BindingException: Invalidbound statement (not found):
在网上找了一些帖子和博文,发现可能是在打包时没有打包mapper.xml文件。最后到target下看,果然在对于的package下没有mapper.xml文件。
针对idea下没有打包package下的mapper.xml的解决方法:
在maven的pom.xml文件的<build>节点下告诉maven我们需要打包的文件: 最后可以在target下看看是否我们编写的mapper.xml文件被打包没有。
总结一下org.apache.ibatis.binding.BindingException: Invalidbound statement (not found):的大多数原因:
1. 先检查自己的mapper.xml文档是否在Mybatis的配置文件中是否加载了。
2. 查看mapper.xml文件中namespace的命名空间是否和接口的类的全名称相同
3. 查看mapper.xml文件中sql语句的id名称是否和接口中的方法名称一致。
4. Sql语句中的参数和返回类型和接口中的参数和返回值类型相同
5. 最后查看生成的target中是否有对于的mapper.xml文件(如果上面都检查没有问题,那一般就是mapper.xml文件没有打包到target中)解决方法:
配置文件出错 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): ,即在mybatis中da ...
- 关于org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.atguigu.crud.dao.DepartmentMapper.insertSelective的错误
今天我在使用mybatis逆向工程的时候,由于一个疏忽字打错了..结果花了一早上才把错误找全..广大小伙伴们一定要小心啊(能复制粘贴就别手打) 关于org.apache.ibatis.binding. ...
- 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 ...
- IDEA异常解决: org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)
有时候解决问题不仅仅是解决问题.-----jstarseven 最近因为开发需要,需要搭建一个ssm开发框架,采用了开发工具IDEA. 整合完了SSM开发框架之后,发布的时候出现org.apache. ...
- 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),部 ...
- Spring扫面路径配置不全导致异常 org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): 的原因
运行Junit测试类 package cn.bgodata.x.zero.service; import org.junit.Test; import org.junit.runner.RunWith ...
- org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)错误几种解决方案
报错信息: org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.study.ser ...
- org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): 问题解决方法
在用maven配置mybatis环境时出现此BindingExceptiony异常,发现在classes文件下没有mapper配置文件,应该是maven项目没有扫描到mapper包下的xml文件,在p ...
- idea 单元测试 mybatis spring-test 异常: org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)
因为在idea中必须在test下才能进行单元测试,所以进行单元测试时,ssm的项目会因为找不到resourece中的配置文件而报错 这里 org.apache.ibatis.binding.Bindi ...
随机推荐
- 如何在ASP.NET Core 2.0中使用Razor页面
如何在ASP.NET Core 2.0中使用Razor页面 DotNetCore2017-11-22 14:49 问题 如何在ASP.NET Core 2.0中使用Razor页面 解 创建一个空的项 ...
- 问题 I: 闪闪发光
[提交] [状态] [命题人:外部导入] 题目描述 一所位于云南昆明的中医药本科院校--云南中医学院. 因为报考某专业的人数骤减,正面临着停招的危机. 其中有九名少女想到一条妙计——成为偶像, 只要她 ...
- html5: 复制到剪贴板 clipboard.js
1.使用clipboard.min.js工具,引用此js 注意事项: IOS微信网页开发中,若使用此工具来开发复制功能,则需要在超链接/按钮上新增 onclick=" " 2.cl ...
- 关于Arduino串口读写HEX
每次和硬件层进行调试的时候,就容易遇到数据格式问题.这不,继上次Matlab上的hex发送后,又遇到了Arduino上接收hex,并进行对比处理的问题.由于单片机级别的处理器只能以字节形式接收,因此无 ...
- .Net的混淆防反编译工具ConfuserEx--2(转)
给大家推荐一个.Net的混淆防反编译工具ConfuserEx. 由于项目中要用到.Net的混淆防反编译工具. 在网上找了很多.Net混淆或混淆防反编译工具,如.NET Reactor.Dotfusca ...
- (转)ELK原理与介绍
原文:https://www.cnblogs.com/aresxin/p/8035137.html 为什么用到ELK: 一般我们需要进行日志分析场景:直接在日志文件中 grep.awk 就可以获得自己 ...
- 爱奇艺视频显示列表CSS实现
css: body{margin:0;font-size: 12px;font-family: "宋体":} ul{margin:0;padding:0;list-style: n ...
- 断开所有远程连接(sql server)
DECLARE @d VARCHAR(8000) SET @d = ' ' SELECT @d = @d + ' kill ' + CAST(spid AS VARCHAR) + CHAR(13)FR ...
- python2和python3中列表推导式的变量泄露问题
Python 2.x 中,在列表推导中 for 关键词之后的赋值操作可能会影响列表推导上下文中的同名变量.像下面这个 Python 2.7 控制台对话: Python 2.7.15 (default, ...
- gradle本地、远程仓库配置--转
https://blog.csdn.net/x_iya/article/details/75040806 本地仓库配置配置环境变量GRADLE_USER_HOME,并指向你的一个本地目录,用来保存Gr ...