mybatis BindingException: Invalid bound statement (not found)
错误截图
解决措施
此异常的原因是由于mapper接口编译后在同一个目录下没有找到mapper映射文件而出现的。
通常我们在配置SqlSessionFactory时会有如配置
<!-- 配置SqlSessionFactory -->
<bean class="org.mybatis.spring.SqlSessionFactoryBean">
<!-- 设置MyBatis核心配置文件 -->
<property name="configLocation" value="classpath:resources/mybatis/mybatis-config.xml" />
<!-- 设置数据源 -->
<property name="dataSource" ref="dataSource" />
<!-- 它表示我们的Mapper文件存放的位置,当我们的Mapper文件跟对应的Mapper接口处于同一位置的时候可以不用指定该属性的值。 -->
<property name="mapperLocations" value="classpath:/mappings/**/*.xml" />
<!-- 那么在Mapper文件里面就可以直接写对应的类名 而不用写全路径名了 -->
<!-- 跟mybatis中<typeAliases>作用一样 -->
<!-- <property name="typeAliasesPackage" value="com.jeenotes.ssm.pojo"/> -->
</bean>
重点是第8行代码,他代表我们的mapper文件存放路径,如果不配置这一行的话,默认路径是你存放dao文件目录,这也就是为何把xml文件放在dao目录跟xxxDao.java文件放在一起不报错,放在其他路径就报错问题所在。
本文地址:http://www.cnblogs.com/niceyoo/articles/8733251.html
mybatis BindingException: Invalid bound statement (not found)的更多相关文章
- mybatis使用时org.apache.ibatis.binding.BindingException: Invalid bound statement (not found):的错误
最近在使用mybatis时,出现了 org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): 这 ...
- MyBatis绑定错误--BindingException:Invalid bound statement (not found)
如果出现: org.apache.ibatis.binding.BindingException: Invalid bound statement (not found) 一般的原因是Mapper i ...
- 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错误之org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)
玩了MyBatis差不多有两年了,中间也玩过MyBatis-Plus,这个MyBatis-Plus其实与MyBatis的区别并不大.今天写博客业务代码的时候,犯一个初学者犯过的错误. 错误信息如下:o ...
- Spring boot结合mybatis开发的报错:org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)
错误:org.apache.ibatis.binding.BindingException: Invalid bound statement (not found),经过排查确定是没有找到xml的原因 ...
- idea 单元测试 mybatis spring-test 异常: org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)
因为在idea中必须在test下才能进行单元测试,所以进行单元测试时,ssm的项目会因为找不到resourece中的配置文件而报错 这里 org.apache.ibatis.binding.Bindi ...
- Mybatis笔记二:org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)
错误异常:org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.test.dao.N ...
- 【mybatis】mybatis访问报错:org.apache.ibatis.binding.BindingException: Invalid bound statement (not found) 或者 feign被调用方使用的mybatis总报空指针异常java.lang.NullPointerException,而变量都没有问题的情况
mybatis访问报错:org.apache.ibatis.binding.BindingException: Invalid bound statement (not found) 需要检查的步骤: ...
- BindingException: Invalid bound statement (not found)问题排查:SpringBoot集成Mybatis重点分析
重构代码,方法抛出异常:BindingException: Invalid bound statement (not found) 提示信息很明显:mybatis没有提供某方法 先不解释问题原因和排查 ...
随机推荐
- 【Vegas原创】SQLServer2008防小人利器:审核/审计功能
小人见怪不怪,世界上最可怕的就是会技术的小人,防不胜防! sa密码泄露也就算了,关键是人家也可以前台攻击,直接把你弄的没辙! 在诅咒这种小人的同时,除了加强服务器安全管理,密码策略等,SQL Serv ...
- laravel中及其常用的一些函数方法(自己看)和技巧(不断添加中)
手册:https://laravelacademy.org/ 1.中间件的定义Middleware 2.路由的定义和写法 3.控制器Controller之Request 4.控制器Controller ...
- LNMP环境的搭建(yum)方法(精)
第一 先安装nginx nginx在官方CentOS社区yum里面没有,需要在nginx的官方网站去下载yum的配置文件 官方:https://www.nginx.com/resources/wiki ...
- pandas DataFrame apply()函数(1)
之前已经写过pandas DataFrame applymap()函数 还有pandas数组(pandas Series)-(5)apply方法自定义函数 pandas DataFrame 的 app ...
- 解决wps/office 1-2自动转换1月2日,用样式解决此问题
添加样式: td{mso-number-format:"\@"; }
- tracert traceroute
二者都用于探测数据包从源到目的经过路由的IP,但两者探测的方法却有差别.不同点:一.应用环境不同tracert是应用在windows下.traceroute则是应用在linux/BSD/router/ ...
- Geoserver GeoWebCache 切图失败 This requested used more time than allowed and has been forcefully stopped. Max rendering time is 60.0s
错误信息: This requested used more time than allowed and has been forcefully stopped. Max rendering time ...
- 01Spark的TopN问题
和hadoop的目的一样,给你数据,然后取TopN.数据如下: 取出数据在排名前十的数据. 代码如下: package com.test.book; import java.util.ArrayLis ...
- netty 的 Google protobuf 开发
根据上一篇博文 Google Protobuf 使用 Java 版 netty 集成 protobuf 的方法非常简单.代码如下: server package protobuf.server.imp ...
- 通用Mapper新特性:ExampleBuilder 2017年12月18日
package tk.mybatis.mapper.test.example; import org.apache.ibatis.session.SqlSession; import org.juni ...