配置文件出错 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 ...
随机推荐
- Java线程池的选择
在java的concurrent.Executors主要提供两种线程池:无固定线程数但有限制任务队列的cachedThreadPool与有固定线程数但无任务队列限制的fixedThreadPool,这 ...
- 开源.net 混淆器ConfuserEx介绍 [转]
今天给大家介绍一个开源.net混淆器——ConfuserEx http://yck1509.github.io/ConfuserEx/ 由于项目中要用到.net 混淆器,网上搜寻了很多款,比如Dotf ...
- OPENERP 中自定义模块 找不到的问题
问题的前提是你写的模块本身没有问题,我自己碰到的情况是在本机运行可以,但是上传到服务器上以后却无论怎么重启服务都找不到模块. 问题的根源在上传的文件权限设置不对: 假设自定义模块为rainsoft_p ...
- Linux网络编程服务器模型选择之循环服务器
在网络程序里面,通常都是一个服务器处理多个客户机,为了出个多个客户机的请求,服务器端的程序有不同的处理方式.本节开始介绍Linux下套接字编程的服务器模型选择,主要包括循环服务器模型.并发服务器模型. ...
- php 使用 rabbitmq
1,配置好rabbitmq 服务器 (参照 http://www.cnblogs.com/spicy/p/7017603.html)(我是linux) 2,新增了一个用户 并点击该用户 增加权限如下
- jdk1.8 HashMap源码讲解
1. 开篇名义 jdk1.8中hashMap发生了一些改变,在之前的版本中hsahMap的组成是数组+链表的形式体现,而在1.8中则改为数组+链表+红黑树的形式实现,通过下面两张图来对比一下二者的不同 ...
- PHP命名规则
参考: http://nowhisky.diandian.com/post/2012-08-12/40033898638 就一般约定而言,类.函数和变量的名字应该是能够让代码阅读者能够容易地知道这些代 ...
- maven 错误:读取 xxx.jar 时出错;invalid LOC header (bad signature) 1 错误
reqHeader:{Accept=text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8, Upgrade-Insecure- ...
- c#删除list中的元素
public static void TestRemove() { string[] str = { "1", "2", "d", &quo ...
- 【总结】java 后台文件上传整理
public Map<String,String> clientUploadAttachment(Long belongId, String fileSource, MultipartFi ...