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 ...
随机推荐
- Python笔记(1)——字符串(Python编程:从入门到实践)
字符串 一.使用方法修改字符串大小写 1. 方法:变量.tittle():首字母大学显示字符串中的每个英文单词 2. 方法:变量.upper():字符串全改为大写 3. 方法:变量.lower():将 ...
- md文件使用说明
md文件简单使用介绍 二级标题 三级标题 斜体文本 粗体文本 粗斜体文本 分隔线 删除号 带下划线 创建脚注格式类似这样 [1]. #include <iostream> using na ...
- POE供电及PD的功率分级
POE供电标准有IEEE802.3af和IEEE802.3at 802.3af,PSE最高提供15.5W的功率而PD端则为12.95W: 802.3at,PSE最高提供30W的功率而PD端则为25W: ...
- DNS服务学习笔记
1.基本概念 DNS(Domain Name System)域名系统,在TCP/IP网络中有非常重要的地位,能够提供域名与IP地址的解析服务. DNS是一个分布式数据库,命名系统采用层次的逻辑 ...
- Nginx自带的变量
$args #请求中的参数值$query_string #同 $args$arg_NAME #GET请求中NAME的值$is_args #如果请求中有参数,值为"?",否则为空字符 ...
- jmeter之阶段式压测
一.bzm - Concurrency Thread Group 1.什么是阶梯式压测 阶梯式压测,就是对系统的压力呈现阶梯性增加的过程,每个阶段压力值都要增加一个数量值,最终达到一个预期值.然后保持 ...
- gogetssl申请的域名证书私钥文件丢了,可以重新申请个吗?
因为gogetssl是不保存我们使用浏览器生成的KEY文件的,CSR文件倒是可以有办法再找到 也就是说Certificate Signing Request(CSR)可以想想办法,但是Your Pri ...
- Ansible之Playbook介绍和使用
1.https://blog.csdn.net/zfw_666666/article/details/124691877 1.Playbook介绍 Playbook与ad-hoc相比,是 ...
- mysql统计特定字符串出现次数
其中'test'为原始字符串,'t'为特定字符串 SELECT floor((char_length('test') - char_length(replace('test', 't', '')) ...
- Java-10接口与抽象类
Java-10接口与抽象类 抽象方法 abstract method机制 这是一个不完整的方法,它只有一个声明,没有方法体 abstract void f(); 包含抽象方法的类被称为抽象类:如果一个 ...