公司决定统一mybatis的工具为mybatis-plus,博主本来用的tk.mybatis。因此需要改些代码…

依赖

    <dependency><groupId>com.baomidou</groupId><artifactId>mybatis-plus-boot-starter</artifactId><version>3.4.2</version></dependency>

改动

实体类注解
@Id => @TableId
@Table => @TableName
MapperScan所依赖的包
tk.mybatis.spring.annotation.MapperScan => org.mybatis.spring.annotation.MapperScan
Mapper类父类
使用com.baomidou.mybatisplus.core.mapper.BaseMapper

当我以为都改好了后,测试了一下mybatis-plus封装好的方法,出现文章标题的问题。
最后查阅资料发现,如果你配置了多数据源,配置类中的SqlSessionFactory要换成MybatisSqlSessionFactoryBean,如下所示:

@Bean("SqlSessionFactory")@Primarypublic SqlSessionFactory SqlSessionFactory(@Qualifier("dataSource") DataSource dataSource) throws Exception{MybatisSqlSessionFactoryBean sqlSessionFactoryBean = new MybatisSqlSessionFactoryBean();sqlSessionFactoryBean.setDataSource(dataSource);sqlSessionFactoryBean.setMapperLocations(new PathMatchingResourcePatternResolver().getResources(mapperLocations));return sqlSessionFactoryBean.getObject();}

到此,mybatis-plus封装的方法就可以正常使用了~

Mybaits-Plus Invalid bound statement (not found) 问题相关推荐

  1. IDEA中Spring Boot+MyBaits提示Invalid bound statement (not found)错误

    记录一下,项目集成遇见问题. 解决方法: 1.查看mapper.xml中 namespace填写是否一致 2.查看mybatis.yml,如下两项配置路径是否与无法找到mapper路径一致 # 配置类 ...

  2. mybatis3:Invalid bound statement (not found)

    最近在玩ssm框架搭建,突然发现最后的时候mybaits和SpringMvc进行整合的时候出现错误 Invalid bound statement (not found) 这个错误有可能出现在以下几个 ...

  3. JakartaEE Exception: Invalid bound statement (not found): com.mazaiting.blog.dao.UserDao.selectUs...

    异常 org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.mazaiting.bl ...

  4. IDEA+Maven+Springboot:invalid bound statement (not found) 解决办法

    自己使用Springboot搭建web项目,之前都是使用注解形式来执行sql获取查询内容,这次本承着闲得无聊试一试的想法,突发奇想想用xml的方式执行sql.很走心的参照自己之前spring项目的书写 ...

  5. Invalid bound statement (not found): com.xsw.dao.CategoryDao.getCategoryById] with root cause

    五月 30, 2018 11:11:03 上午 org.apache.catalina.core.StandardWrapperValve invoke 严重: Servlet.service() f ...

  6. 解决INVALID BOUND STATEMENT (NOT FOUND)(MYBATIS的MAPPER绑定问题)

    解决INVALID BOUND STATEMENT (NOT FOUND)(MYBATIS的MAPPER绑定问题) 参考文章: (1)解决INVALID BOUND STATEMENT (NOT FO ...

  7. mybatis配置时出现org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)...

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

  8. 【踩坑】遇到 org.apache.ibatis.binding.BindingException: Invalid bound statement (not found) 报错...

    今天在重做 iblog 客户端时,测试接口情况,发现了 org.apache.ibatis.binding.BindingException: Invalid bound statement (not ...

  9. Maven项目mybatis Invalid bound statement (not found)解决方法

    最近因为工作需要,要学习mybatis框架.在添加好一些依赖之后,通过mybatis进行数据库的crud操作.但是在测试的时候总是报mybatis:Invalid bound statement (n ...

  10. 解决Mybatis启动报错: Invalid bound statement (not found)

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

最新文章

  1. android handler作用,Android中Handler的作用
  2. 牛客网暑期ACM多校训练营(第五场)A-gap (二分答案)
  3. 阿里巴巴制定了这 16 条
  4. 小猿圈python学习-函数的递归
  5. MyEclipse设置代码自动补全,及取消空格和‘=’补全
  6. 【电路】简易的桥式整流电路---选取滤波电容
  7. php solr 全文检索,全文检索可视化动态管理(二)--solr二次开发和solrj扩展
  8. 第十五章 iptables
  9. spark的集群安装
  10. hql语句关联查询(select new )
  11. ubuntu(乌班图) 修改ip
  12. 曼哈顿距离与切比雪夫距离的亲密♂关系。
  13. 高中计算机教室标语,高中教室宣传标语
  14. Latest for Mac 0.7.3 应用更新管理器
  15. 灵遁者散文小说集《从今往后》:永远都是开始
  16. ac2100 反弹shell无法粘贴_【1029精简稳定版OpenWrt】红米&小米AC2100|帕斯沃|多拨|SmartD...
  17. ASO | APP推广之ASO优化中的九大奥义。
  18. 实战教程!利用Python获取数据,并在地图上批量标注
  19. 【JAVA】使用javax.mail发送邮件
  20. 渗透测试-逻辑漏洞出现场景、利用方式总结

热门文章

  1. subclass and extends
  2. Zerg虫族的传说[官方资料]
  3. 使用nodebb搭建一个论坛
  4. 出现Avoid mutating a prop directly since the value will错误 已解决
  5. 【目标检测】已知top, left, bottom, right 求 xmin,ymin,xmax,ymax
  6. 快快436 高智商罪犯一
  7. 简单易学的win10安装教程,值得收藏
  8. 学习OpenCV(4) 基于OpenCV的双目测距程序
  9. 如何成为一名云计算工程师
  10. 让我的诗句带走你的空虚