Junit启动测试mybatis xml文件BindingException: Invalid bound statement问题
背景:1、正常启动,xml文件放在java目录和resource目录下均正常
2、junit启动,xml文件放在resource目录下正常,放在java目录下报BindingException错误
mapperlocation绑定地址为:"classpath:com/a/b/**/*.xml"
原因就在于绑定的地址有问题。
junit生成的test-classes下的测试类test所在目录与classes所在目录相同 都存在com/a/b
启动时首先会找test-classes下的xml,肯定找不到,则不会继续找
所以有两种解决方案:1、路径改为 "classpath*:com/a/b/**/*.xml" 第一个找不到会继续找
2、路径改为 "classpath:com/a/b/c/*.xml" 写全路径
至于放在resource目录下可以找到,是因为xml文件只有在classes下面会存在,所以会顺着路径去找,"classpath:/mapper/**/*.xml"
Junit启动测试mybatis xml文件BindingException: Invalid bound statement问题的更多相关文章
- MyBatis绑定错误--BindingException:Invalid bound statement (not found)
如果出现: org.apache.ibatis.binding.BindingException: Invalid bound statement (not found) 一般的原因是Mapper i ...
- 解决 org.apache.ibatis.binding.BindingException: Invalid bound statement (not found) 以及MyBatis批量加载xml映射文件的方式
错误 org.apache.ibatis.binding.BindingException: Invalid bound statement (not found) 的出现,意味着项目需要xml文件来 ...
- 【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) 需要检查的步骤: ...
- mybatis使用时org.apache.ibatis.binding.BindingException: Invalid bound statement (not found):的错误
最近在使用mybatis时,出现了 org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): 这 ...
- 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的原因 ...
- 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 ...
- BindingException: Invalid bound statement (not found)问题排查:SpringBoot集成Mybatis重点分析
重构代码,方法抛出异常:BindingException: Invalid bound statement (not found) 提示信息很明显:mybatis没有提供某方法 先不解释问题原因和排查 ...
- 【spring boot Mybatis】报错:org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.newhope.interview.dao.UserMapper.add
报错如下: org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.newhope.i ...
随机推荐
- KMP算法学习记录
Foreword: 初学KMP匹配算法,不得其门,总感觉自己想,想不出来,看书上文字解释晦涩难懂.不能准确的捕捉算法设计时候的灵光和思路 .于是自己试着完成了一遍,现将过程记录下来,以供复习. Con ...
- Hspui的使用,NJUPT
一.打开Hspui,进入UI界面 二.添加.sp文件 File->Open打开想要仿真的文件 三.运行仿真 点击Simulate 四.观察结果 点击Waveview进入波形观察器 选中目录下要观 ...
- jmeter 变量的使用
jmeter添加变量 一.添加用户自定义变量 添加用户自定义变量 作用:常用数据参数化.当变量发生变化时,不需要逐个脚本修改,只需要修改用户自定义中的变量就可以了. 变量使用如下图 二.函数助手定义变 ...
- Chrome(谷歌)浏览器永久关闭恢复页面提示框(记录)
使用脚本调用Chrome浏览器启动指定页面,然后代码里的命令关闭,会被浏览器识别为非正常关闭. 再次执行脚本的时候会停留在空白页面,无法进入指定页面,设置为主页也无法进入. 排查可能是浏览器自动恢复页 ...
- vim的visual模式和列编辑
有三种方式进入visual模式: 1> 在普通模式下输入v(小写),底部提示信息为VISUAL,编辑粒度为字符 通过方向键或者HJKL调整选择的字符范围. 输入d,删除选中字符: 输入y,复制当 ...
- 配置git到码云
一.安装完git之后,对项目文件点击右键选择Git Base Here #Git 全局设置用户名与邮箱 git config --global user.name "" git c ...
- C#中冒号:使用场景
1. 继承类.实现接口与继承构造函数 ① 继承类 /// <summary> /// MainWindow.xaml 的交互逻辑 /// </summary> public p ...
- NDVI最大值合成
这里有NDVI250m分辨率的数据,目标:合成年最大值数据 [Spatial Analyst工具]|[局部分析]|[像元统计数据]
- https加固,https://ip暴露后端IP。
增加server配置server { listen 443 default_server; server_name _ ; ssl on; ssl_certificate test.crt 随便设置一 ...
- 给生活加点惊喜,做创意生活的原型设计师丨编程挑战赛 x 选手分享
前言 做产品的大都跳过一个坑:我有了一个很好的产品创意,只差一个程序员帮我实现编程了. 事实上从产品创意到落地上线,中间需要经过非常复杂的过程,细节的逻辑流程才是难点,创意不能落地,并不值钱. 本文作 ...