pagehelper调用mybatis报错java.lang.NoSuchMethodError:org.apache.ibatis.reflection.MetaObject.forObject

最近在升新的基础框架到spring cloud,启动时pagehelper报错,如下:

java.lang.NoSuchMethodError:org.apache.ibatis.reflection.MetaObject.forObject(Ljava/lang/Object;Lorg/apache/ibatis/reflection/factory/ObjectFactory;Lorg/apache/ibatis/reflection/wrapper/ObjectWrapperFactory;)Lorg/apache/ibatis/reflection/MetaObject;

       atcom.github.pagehelper.SqlUtil.forObject(SqlUtil.java:78)

       atcom.github.pagehelper.SqlUtil.getsqlSource(SqlUtil.java:521)

       atcom.github.pagehelper.SqlUtil.getMappedStatement(SqlUtil.java:444)

       atcom.github.pagehelper.SqlUtil.processCountMappedStatement(SqlUtil.java:143)

       atcom.github.pagehelper.PageHelper.intercept(PageHelper.java:140)

       atorg.apache.ibatis.plugin.Plugin.invoke(Plugin.java:61)
经查是pagehelper版本太高,自动引入的是5.x的,将为4.1.8之后,问题解决。

pagehelper的几个要点:

1、pagehelper真正改写sql是在最后getBoundSql的时候,而不是提前注入值。

 

2、采用的是jsqlparser解析器,它比druid sql弱得多,不过因为是最简单的解析,问题不是很大。

3、分页的执行是串行的,可以考虑并行。

 

posted @   zhjh256  阅读(4091)  评论(0编辑  收藏  举报
编辑推荐:
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
阅读排行:
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· 没有Manus邀请码?试试免邀请码的MGX或者开源的OpenManus吧
· 【自荐】一款简洁、开源的在线白板工具 Drawnix
· 园子的第一款AI主题卫衣上架——"HELLO! HOW CAN I ASSIST YOU TODAY
· Docker 太简单,K8s 太复杂?w7panel 让容器管理更轻松!
历史上的今天:
2016-11-10 tomcat 7下spring 4.x mvc集成websocket以及sockjs完全参考指南(含nginx/https支持)
2016-11-10 mysql 5.6 read-committed隔离级别下并发插入唯一索引导致死锁一例(GAP锁的问题)
2016-11-10 jackson中JSON字符串节点遍历和修改
点击右上角即可分享
微信分享提示