springboot+mybatis报错Invalid bound statement (not found)
今天做项目时报了一个错提示说Invalid bound statement (not found),也就是说mapper接口绑定.xml文件出错了,找不到指定的sql;原因是程序没有把.xml文件编译到classes路径下,这时需要在pom.xml文件的<build>标签中加入下面的配置解决
<resources>
<!-- maven项目中src源代码下的xml等资源文件编译进classes文件夹,
注意:如果没有这个,它会自动搜索resources下是否有mapper.xml文件,
如果没有就会报org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.pet.mapper.PetMapper.selectByPrimaryKey-->
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.xml</include>
</includes>
</resource> <!--将resources目录下的配置文件编译进classes文件 -->
<resource>
<directory>src/main/resources</directory>
</resource>
</resources>
springboot+mybatis报错Invalid bound statement (not found)的更多相关文章
- 解决Mybatis 报错Invalid bound statement (not found)
解决Mybatis 报错Invalid bound statement (not found) 出现此错误的原因 1.xml文件不存在 2.xml文件和mapper没有映射上 namespace指定映 ...
- MybatisPlus报错Invalid bound statement (not found)的解决方案
今天使用MybatisPlus,测试时报错Invalid bound statement (not found) 使用自定义的mapper接口中的方法可以执行,而调用MybatisPlus中baseM ...
- 使用Mybatis时报错Invalid bound statement (not found):
使用逆向工程时生成的.xml文件在conf目录下,而使用查询方法时,无法在dao包下找到xml文件,所以报错. 测试代码如下所示: @Test public void testSimple() thr ...
- IDEA maven项目下测试mybatis例子,使用mappper class或package引入mapper映射文件,总是报错Invalid bound statement(所有配置完全正确)
困扰几个小时,终于查到解决办法及原因(可以直接到最后看解决方案) 环境就是用IDEA搭建的maven项目,主要jar包引入配置如下 <dependencies> <dependenc ...
- Mybatis plus 报错Invalid bound statement (not found) 终极解决办法
我产生的错误原因是写的mapper继承BaseMapper没有添加泛型: 点进去: 为了解决这个bug,网上很多人也提出了解决办法:1.检查xml文件的namespace是否正确 2.Mapper.j ...
- [mybatis] mybatis错误:Invalid bound statement (not found)
点击菜单抛出异常: org.springframework.web.util.NestedServletException: Request processing failed; nested exc ...
- mybatis 异常处理:Invalid bound statement (not found)
mybatis 的使用过程中提示错误: org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): ...
- MyBatis绑定错误[Invalid bound statement (not found)]
如果出现: org.apache.ibatis.binding.BindingException: Invalid bound statement (not found) 一般的原因是Mapper i ...
- MyBatis 错误:Invalid bound statement (not found)
错误: org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.zr.msgg.per ...
随机推荐
- 未安装Oracle数据库,使用PL\SQL Developer连接远程数据库解决方案
使用PL/SQL远程连接Oracle服务器 背景:本地未安装oracle数据库服务器,希望远程连接Oracle服务器 1.下载oracle数据库客户端 下载64位windows的instantclie ...
- ubuntu Redis安装及配置
1.安装 1.1 下载压缩包:wget http://download.redis.io/releases/redis-5.0.4.tar.gz1.2 解压:tar xzf redis-5.0.4.t ...
- 文本中自动出现的 ​
文本中自动出现的 ​ 所借鉴原页面地址:https://blog.csdn.net/judyc/article/details/53097142 因判断容器内字符长度来做其它处理 ...
- JavaScript控制流和表达式
一.with语句 使用with语句可以简化JavaScript语句的一些类型,即把一个对象的多个引用降为一个引用,对with块里的属性和方法的引用将被看作是对对象的引用. <script> ...
- 迭代器iterator遍历map集合
结果:
- orcal时区
查询数据库时区 select dbtimezone from dual 修改时区 alter database set time_zone='+8:00';
- Java必须知道的知识点
junit用法,before,beforeClass,after, afterClass的执行顺序 分布式锁 nginx的请求转发算法,如何配置根据权重转发 用hashmap实现redis有什么问题( ...
- .Net中C# Dictionary 用法
Dictionary提供快速的基于键值的元素查找. 结构是:Dictionary <[key] , [value] >,当你有很多元素的时候可以用它. 它包含在System.Collect ...
- java 发送简单邮件(不带附件)
引入依赖 邮件实体类 可用邮件服务器地址(网易为例) 邮件工具类 import com.me.beans.Mail; import lombok.extern.slf4j.Slf4j; import ...
- istio部署-istio prometheus
参考 fleeto/sleep fleeto/flaskapp 1. 使用 Prometheus 1.1 访问 Prometheus 1.1.1 端口转发 Prometheus 服务默认启用. # o ...