场景

在使用SpringBoot+MyBatisPlus搭建后台启动项目时,使用EasyCode自动生成代码。

在访问后台接口时提示:

Invilid bound statement (not found):**.dao.UserDao.queryById

注:

博客:
https://blog.csdn.net/badao_liumang_qizhi
关注公众号
霸道的程序猿
获取编程相关电子书、教程推送与免费下载。

实现

首先第一步是会想到dao层的注入有问题。

在使用EasyCode生成代码后,默认生成代码模板中是没有添加@Mapper注解或者在启动类中添加@MapperScan注解。

二者选其一,这里在启动类上添加mapper层扫描注解。

如果在添加后仍然不起作用,在运行项目时不报错,但是在进行后台接口请求时还是提示以上问题。

那么此时应该就是配置文件有问题了。

找到配置文件application.yml

添加mapper配置文件扫描的配置

  mapper-locations: classpath:mapper/*Dao.xml

添加位置参照以下代码

server:
port:
spring:
datasource:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://localhost:3306/usr
username: root
password:
mybatis-plus:
#信息输出设置
# xml地址
mapper-locations: classpath:mapper/*Dao.xml
# 实体扫描,多个package用逗号或者分号分隔
# type-aliases-package: *** #自己的实体类地址
configuration:
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl

SpringBoot+MyBatisPlus整合时提示:Invalid bound statement(not found):**.dao.UserDao.queryById的更多相关文章

  1. mybatis-plus配置多数据源invalid bound statement (not found)

    mybatis-plus配置多数据源invalid bound statement (not found) 错误原因 引入mybatis-plus应该使用的依赖如下,而不是mybatis <de ...

  2. 在使用mybatis的selectFromExample时出现Invalid bound statement (not found)错误

    主要原因:运行项目在构建的时候只会默认的去加载resource资源文件里面的资源,其他地方的配置资源不会加载 .故没有读取到mybatis的MapperXml映射 结构如下 ============= ...

  3. springmvc-mybatis整合出错: Invalid bound statement (not found)

    Invalid bound statement (not found):(自己dao里面的某个方法) 错误原因:在使用mybatis generator插件自动生成代码后将UserMapper.jav ...

  4. 访问mapper方法提示invalid bound statement (not found)原因总结

    1.访问所有的mapper都报此错误,检查 mapper.xml 中的 namespace 2.访问mapper中的部分方法时报此错误,检查xml文件中的id是否和接口中的方法名一致 3.mapper ...

  5. mybatis提示Invalid bound statement (not found)错误的可能原因

    https://www.cnblogs.com/liaojie970/p/8034525.html

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

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

  7. idea报错:Invalid bound statement (not found)

    在配置MyBatis接口映射的Mapper.xml时,提示Invalid bound statement (not found)异常,就算是接口和xml名字相同,路径相同也无法找到,在网上找到了几种解 ...

  8. Java学习-052-(mybatis+mysql)访问接口时提示:org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)

    在配置mybatis,访问接口提示: org.apache.ibatis.binding.BindingException: Invalid bound statement (not found),部 ...

  9. 13. 关于IDEA工具在springboot整合mybatis中出现的Invalid bound statement (not found)问题

    在一切准备就绪之后,测试test,却出现了org.apache.ibatis.binding.BindingException: Invalid bound statement (not found) ...

随机推荐

  1. Linux下搭建HttpRunnerManager接口测试平台

    前言 之前在学习HttpRunner时,我们都是把用例写在 YAML/JSON 中进行维护,使用起来也很方便.其实,现在有不少大佬都喜欢开发自动化测试平台,比如我们今天要搭建的HttpRunnerMa ...

  2. 面向对象的进阶(item系列,__new__,__hash__,__eq__)

      面向对象的进阶(item系列,__new__,__hash__,__eq__) 一.item系列 getitem.setitem.delitem(操作过程达到的结果其实就是增删改查) class ...

  3. C# format格式对齐

    1.24小时时间格式制定 按照2019-12-10-13-00-00格式输出:string dtnow = string.Format("{0:yyyy-MM-dd-HH-mm-ss}&qu ...

  4. FCC---CSS Flexbox: Align Elements Using the justify-content Property

    Sometimes the flex items within a flex container do not fill all the space in the container. It is c ...

  5. 知识图谱基础之RDF,RDFS与OWL

    https://blog.csdn.net/u011801161/article/details/78833958 https://blog.csdn.net/baidu_15113429/artic ...

  6. centos7配置Memcached

    Memcached是一套分布式的高速缓存系统,用于提升网站访问速度,尤其对于一些大型的.需要频繁访问数据库的网站,访问速度提升效果十分显著. 1.安装memcached yum install mem ...

  7. Nuxt+Vuex初体验

    小呀嘛小二郎,背着书包上学堂... 今天一个困扰了我一周时间的问题终于被我解决了,值得庆祝 在Nuxt中使用Vuex实现数据存储 首先: 在store目录下新建一个index.js文件 需要有两个组件 ...

  8. React Native-ios环境的搭建

    要在mac系统上搭建RN环境: 一.安装Homebrew.它是一款Mac OS平台下的软件包管理工具. 详见Homebrew的安装这篇文章. 二.安装node和watchman,用Homebrew在命 ...

  9. CGI environment variables

  10. 数据库索引的优化及SQL处理过程

    想要设计出好的索引,首先必须了解SQL语句在数据库服务器中的处理过程,本文介绍数据库索引设计与优化中几个对索引优化非常重要的概念. 谓词 谓词就是条件表达式. SQL语句的where子句由一个或者多个 ...