配置文件出错 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 ...
随机推荐
- c#StreamWriter,StreamReader类(主要用于文本文件访问)
1.为什么要使用StreamReader或者StreamWriter 如果对文本文件需要读取一部分显示一部分则使用FileStream会有问题,因为可能FileStream会在读取的时候把一个汉字的字 ...
- 第2章—装配Bean—自动化装配Bean
自动化装配Bean 2.1.Spring配置可选方案 装配是依赖注入DI的本质,Spring提供了以下三种注入的装配机制: 在XMl中进行显式配置 在java中进行显式配置 隐式的Bean发现机制 ...
- 【Qt开发】常用控件--QLineEdit
QLineEdit是单行文本编辑控件.比如用户名,密码等输入框可以使用该控件. 所属头文件<QLineEdit> 常用方法 1.void setText(const QString &am ...
- python-thread封装类创建线程
#!/usr/bin/python #coding=utf-8 from time import ctime,sleep import threading class Mythead(threadin ...
- Tomcat的配置文件Server.xml解析
配置元素说明: 元素名 属性 解释 server port 指定一个端口,这个端口负责监听关闭tomcat 的请求 shutdown 指定向端口发送的命令字符串 service name 指定serv ...
- Package.json中dependencies依赖包中^符号和~符号前缀的区别
刚git了webpack的包发现package.json里面dependencies依赖包的版本号前面的符号有两种,一种是~,一种是^,如下图标记: 然后搜了下在stackoverflow上找到一个比 ...
- js 列表选择
首选定义数组,然后进行操作时遍历数组获取选中值 function getSelect(userId) { //var userId = userCheckBox.value; //标记删除还是添加 v ...
- TextBox 控件
TextBox控件上有一个箭头,MultiLine属性,是多行显示 TextBox控件有System.Windows.TextBox类提供,提供了基本的文本输入和编辑功能 属性 A ...
- 第9天:原型、继承、函数使用推荐以及this的指向
原型 javascript原型指向改变如何添加方法和访问 <!DOCTYPE html> <html lang="en"> <head> < ...
- sublime下package control安装无效解决
使用快捷键:ctrl+`打开控制台执行如下命令 sublime2: import urllib2,os,hashlib; h = 'df21e130d211cfc94d9b0905775a7c0f' ...