今天做项目时报了一个错提示说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)的更多相关文章

  1. 解决Mybatis 报错Invalid bound statement (not found)

    解决Mybatis 报错Invalid bound statement (not found) 出现此错误的原因 1.xml文件不存在 2.xml文件和mapper没有映射上 namespace指定映 ...

  2. MybatisPlus报错Invalid bound statement (not found)的解决方案

    今天使用MybatisPlus,测试时报错Invalid bound statement (not found) 使用自定义的mapper接口中的方法可以执行,而调用MybatisPlus中baseM ...

  3. 使用Mybatis时报错Invalid bound statement (not found):

    使用逆向工程时生成的.xml文件在conf目录下,而使用查询方法时,无法在dao包下找到xml文件,所以报错. 测试代码如下所示: @Test public void testSimple() thr ...

  4. IDEA maven项目下测试mybatis例子,使用mappper class或package引入mapper映射文件,总是报错Invalid bound statement(所有配置完全正确)

    困扰几个小时,终于查到解决办法及原因(可以直接到最后看解决方案) 环境就是用IDEA搭建的maven项目,主要jar包引入配置如下 <dependencies> <dependenc ...

  5. Mybatis plus 报错Invalid bound statement (not found) 终极解决办法

    我产生的错误原因是写的mapper继承BaseMapper没有添加泛型: 点进去: 为了解决这个bug,网上很多人也提出了解决办法:1.检查xml文件的namespace是否正确 2.Mapper.j ...

  6. [mybatis] mybatis错误:Invalid bound statement (not found)

    点击菜单抛出异常: org.springframework.web.util.NestedServletException: Request processing failed; nested exc ...

  7. mybatis 异常处理:Invalid bound statement (not found)

    mybatis 的使用过程中提示错误: org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): ...

  8. MyBatis绑定错误[Invalid bound statement (not found)]

    如果出现: org.apache.ibatis.binding.BindingException: Invalid bound statement (not found) 一般的原因是Mapper i ...

  9. MyBatis 错误:Invalid bound statement (not found)

    错误: org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.zr.msgg.per ...

随机推荐

  1. 全栈高级web前端工程师的必经之路

    这是最近整理的一个进阶高级web工程师的技术栈 同时也是激励自己每天来看一下离真正的王者还有多少距离! 过段时间再来反思一下自己进步了多少? ------------------------20190 ...

  2. SpringMVC-简单参数绑定

    SpringMVC-简单参数绑定    众所周知,springmvc是用来处理页面的一些请求,然后将数据再通过视图返回给用户的,前面的几篇博文中使用的都是静态数据,为了能快速入门springmvc,在 ...

  3. nodemon:无法将“nodemon”项识别为 cmdlet、函数、脚本文件或可运行程序的名称。

    主要问题还是你的终端(也就是你的nodemon命令执行的地方没有这个环境) 解决方法:设置全局的nodemon,在终端执行 npm install -g nodemon

  4. http接口的调用

    1.按照文档先写入参数,这里主要介绍 Json格式的String字符串,包括拼接数组 String sqr_arry [] = new String[rowList.size()]; for(int ...

  5. x = cos x 的解析形式

    x = cos x 的解析形式 玩计算器的发现 大家都玩过计算器吧, 不知注意到没有. 输入任意数, 然后不断按最后总会输出. 什么, 你说明明记得是:? 哦, 因为你用了角度制. 这一系列操作等价于 ...

  6. SQL语句性能分析

    SQL语句性能分析 explain执行计划 用法: explain select 语句 命令: show database; use mysql explain select * from user; ...

  7. C语言-数组指针与指针数组

    1.思考 下面这些声明合法吗? int array[5]; int matrix[3][3]; int * pa = array; int * pm = matrix; 问题: array代表数组首元 ...

  8. el-popover 点击input框出现table表,可点击选中,可拼音检索完回车选中

    <template> <card> <el-popover placement="right" width="400" trigg ...

  9. Java接收前台传回的json

    var list = new Array(); var obj = {}; obj.name= "zhangsan"; obj.sex= "女";obj.ema ...

  10. 利用Python数据分析基础

    一.Numpy的ndarray:一种多维数组 ndarray是一个通用的同构多维数据容器,其所有元素必须是相同的类型.每个数组都有一个shape(一个表示各维度的元组)和dtype(一个用于说明数据数 ...