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 ...
随机推荐
- MPC
Just for anyone searching for code. I found it here: https://drive.google.com/drive/folders/0BzLEHBD ...
- HashMap记录
1.HashMap接收null的键值 2.HashMap是非synchronized的 3.HashMap使用hashCode找到bucket的位置.bucket中存储的是键和值 4.当HashCod ...
- NodeJS - XSS
首先进入/skf-labs-master/XSS文件夹下,执行命令: $ npm install $ npm start 抓包看看内容 查看源码 app.post("/home", ...
- 字符串练习2 最长抑或路径(01trie树)
题目链接在这里:P4551 最长异或路径 - 洛谷 | 计算机科学教育新生态 (luogu.com.cn) 是一道比较经典的问题,对于异或问题经常会使用01trie树来解决. 当然01trie树只是用 ...
- FIRE2023:殁亡漫谈
FIRE2023:殁亡漫谈 读书的时候,想到殁亡,脑海涌出一则喜欢的遗言: 钱花完了,我走了.签名 如果可能牵涉到旁人(比如殁在旅馆里),就再立一则: 我的殁与店家无关. 签名 然后放下Kindle, ...
- 实验2:Open vSwitch虚拟交换机实践(补实验一作业链接)
实验1:SDN拓扑实践 实验2:Open vSwitch虚拟交换机实践 一.实验目的 能够对Open vSwitch进行基本操作: 能够通过命令行终端使用OVS命令操作Open vSwitch交换机, ...
- NX二次开发获取NX主程序路径
//头文件 #include <Windows.h> #include <iostream> #include <NXOpen/ListingWindow.hxx> ...
- 关于proTable设置列固定,始终没有固定的效果的原因
使用proTable设置操作列固定 const columns: ProColumns<IssueItem>[] = [ { title: '操作', valueType: 'option ...
- 如何使用webgl(three.js)实现3D消防、3D建筑消防大楼、消防数字孪生、消防可视化解决方案——第十八课(一)
序: 又是很久没出随笔文章了,一篇文章有时候整理一天,实在是抽不出来时间. 最近在回顾几年前的项目时,发现这个智慧三维消防可视化项目很有回顾价值,索性就拿出来讲讲. 首先,我们要知道消防里的知识,不是 ...
- Android studio 安装过程中SDK的环境配置问题
SDK的环境配置问题 在之前的某一篇中,我也提到过在Ecplise里面的SDK的环境配置,二者确实不太一样! 一.系统环境变量新增一个 变量名为:ANDROID_HOME 变量值为:浏览到下载SDK的 ...