使用mybatis,遇到Invalid bound statement (not found): cn.zss.zsdemo.mapper.RoleMapper.selectByPrimaryKey 这个问题,困扰了我好几天,在网上找了许多方法使用没有解决。

这个问题不好查,会报这个错的原因太多了,网友整理的查找原因方法如下:

1、检查mapper.xml文件中<mapper namespace="xxxMapper"> 标签是否指向了正确的mapper接口;

我的是正确的
2、检查是否正确显式指定mapper接口所在位置

方式一:启动类上添加注解@MapperScan(“com.xxs.shirodemo.dao”)

方式二:在每一个mapper接口上添加注解@Mapper

3、检查mapper.xml的配置路径是否正确

mybatis:
                mapper-locations: classpath*:mapping/*.xml

4、检查mapper接口中的方法名与mapper.xml中操作的id是否相同、是否有一方缺少。

我的问题就出在第3条,我把mybaits配置放在了spring:  下,其实要单独拉出来与spring并列

如图

spring:
datasource:
……
freemarker:
…… mybatis:
mapper-locations: classpath*:mapper/*.xml
type-aliases-package: cn.zss.zsdemo.entity #log4j2
logging:
config: classpath:log4j2.xml


奇葩问题:Invalid bound statement (not found): cn.zss.zsdemo.mapper.RoleMapper.selectByPrimaryKey的更多相关文章

  1. org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): cn.e3mall.search.mapper.ItemMapper.getItemList

    java.lang.RuntimeException: org.apache.ibatis.binding.BindingException: Invalid bound statement (not ...

  2. Invalid bound statement (not found): com.shizongger.chapter2.mapper.UserMapper.insertUser 解决方案

    在配置MyBatis时报错信息如下: Invalid bound statement (not found): com.shizongger.chapter2.mapper.UserMapper.in ...

  3. Invalid bound statement (not found) 找不到mapper 映射文件异常

    访问页面报如下错(注意第一行后面的 invalid bound statement (not found)) 这时候再mapper的pom.xml文件要加如下. 否则该节点mybatis的mapper ...

  4. Invalid bound statement (not found): com.example.managerdemo.mapper.SingleTableMapper.selectAllValuesByConditionsNoPage

    报Invalid bound statement (not found): com.example.managerdemo.mapper.SingleTableMapper.selectAllValu ...

  5. 解决Invalid bound statement (not found)(Mybatis的Mapper绑定问题)

    一.问题描述 使用mybatis的项目在本地可以正常运行,但当使用maven或Jenkins打包部署到服务器上时出现了绑定错误,异常信息为: org.apache.ibatis.binding.Bin ...

  6. org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): cn.gaiay.business.helper.dao.LiveRegenrationRecordMapper.insert

    原因分析: 字段名称.报名.类名 对应不上 ,比如colomn和property属性 反了.. 按以下步骤一一执行: 1:检查xml文件所在的package名称是否和interface对应的packa ...

  7. Invalid bound statement(not found):cn.e3mall.mapper.TbItemMapper.selectByExample.....

    1.出现如下问题: 说明mapper接口和mapper.xml映射文件没有在一个文件夹下面 2.解决方法: 在dao层的pom.xml中配置一下: <!-- 如果不添加此节点mybatis的ma ...

  8. Mybatis中的Caused by: org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): 找不到Mapper.xml文件的问题

    1 首先在配置mapper-locations的时候: classpath:  只在现有目录下寻找配置文件 classpath*: 在现有的项目目录下和依赖的jar包下寻找xml配置文件

  9. Invalid bound statement (not found): com.up.sell.mapper.system.H5operationMapper.

    springboot + mybatis项目,出现这样的错误原因就是mapper类的名字和xml的id不对应或者是忘记写了,仔细检查一下吧

随机推荐

  1. 如何在ASP.NET Core中上传超大文件

    HTML部分 <%@PageLanguage="C#"AutoEventWireup="true"CodeBehind="index.aspx. ...

  2. POJ 2104 K-th Number ( 求取区间 K 大值 || 主席树 || 离线线段树)

    题意 : 给出一个含有 N 个数的序列,然后有 M 次问询,每次问询包含 ( L, R, K ) 要求你给出 L 到 R 这个区间的第 K 大是几 分析 : 求取区间 K 大值是个经典的问题,可以使用 ...

  3. Sign on Fence(连续的长为W的一段中最小的数字的最大值)

    题目链接:http://codeforces.com/problemset/problem/484/E 题意:给你个n,n个木板都有高度,宽度都为1 ,给你两个数[l,r]和一个w,求在[l,r]区间 ...

  4. FCC成都社区·前端周刊 第 2 期

    01. Propel:JS的科学计算框架 Propel 是一种 JavaScript 科学计算框架,类似于 Python 中的科学计算库 NumPy,也就是说利用 JS 也可以进行机器学习啦.Prop ...

  5. ODB Examples

    http://www.codesynthesis.com/products/odb/examples.xhtml The following list gives an overview of the ...

  6. 使用tushare获取股票历史数据和实时分笔数据

    使用tushare获取股票历史数据和实时分笔数据   财经数据接口包tushare的使用(一) Tushare是一款开源免费的金融数据接口包,可以用于获取股票的历史数据.年度季度报表数据.实时分笔数据 ...

  7. onload in JavaScript

    https://www.w3schools.com/tags/ev_onload.asp Example Execute a JavaScript immediately after a page h ...

  8. ubuntu命令整理中

    系统变量文件: ~/.bashrc 打印系统变量:echo $ANDROID_NDK 查看磁盘空间:df -h 解压缩: .tar.gz 解压:tar zxvf FileName.tar.gz 压缩: ...

  9. 搭建python-flask开发环境

    ubuntu环境 1. 更新系统软件源: 没有通过更新系统软件源的话,可能无法通过apt-get install安装我们需要用到的软件: $ sudo apt-get update $ sudo ap ...

  10. SpringBoot系列:一、SpringBoot搭建

    打开IDEA,新建一个spring工程,然后无脑下一步就行. 新建完成后的目录结构 java文件夹下是java源码 resources下是配置文件 test下是测试文件 添加web模块支持,在pom. ...