配置文件出错 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 ...
随机推荐
- 网络基础 08_NAT
1 NAT的基本概念 为什么需要NAT IPv4地址紧缺 什么是NAT NAT(Network Address Translation) 私有IPv4地址 10.0.0.0 - 10.255.255. ...
- Linux/Mac安装oh-my-zsh后不执行~/.bash_profile、~/.bashrc解决办法
安装了zsh之后默认启动执行脚本变为了-/.zshrc. 解决办法: Mac: 修改-/.zshrc文件,在其中添加:source -/.bash_profile.source -/.bashrc:注 ...
- 协作式取消 CancellationTokenSource
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.T ...
- PowerDesigner16 生成的备注脚本,在sql server 2008 中报“对象名 'sysproperties' 无效”的错误的解决办法
主要是在建模时我们对表.列增加了些说明注释,而Sql2005之后系统表sysproperties已废弃删除而改用sys.extended_properties所致. 1.修改Table TableCo ...
- (转)GlusterFS 01 理论基础,企业实战,故障处理
https://jaminzhang.github.io/glusterfs/GlusterFS-01-Theory-Basis/--------GlusterFS 01 理论基础 https://j ...
- 第十篇--------javascript函数-参数
javascript函数的参数:形参,实参 //function 参数 //形参列表 function test(a,b,c,d){ //alert(test.length); //形参个数,4个 / ...
- JavaScript设计模式-19.代理模式
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title> ...
- Nginx 的信号控制
摘自:Nginx服务器初识:Nginx启动.停止与信号控制 名称 功能 说明 HUP 重启 QUIT 从容关闭 TERM 快速关闭 INT 从容关闭 USR1 切换日志文件 通常用在切 ...
- 和为S的连续正数序列★★
题目描述 小明很喜欢数学,有一天他在做数学作业时,要求计算出9~16的和,他马上就写出了正确答案是100.但是他并不满足于此,他在想究竟有多少种连续的正数序列的和为100(至少包括两个数).没多久,他 ...
- [转载]Vue 2.x 实战之后台管理系统开发(一)
2. 开发前须知 我的后台管理系统项目运用了如下框架/插件: Vue 2.x —— 项目所使用的 js 框架,我所使用的版本是:2.1.10 vue-router 2 —— Vue 2.x 配套路由, ...