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、分頁的執行是串行的,可以考慮並行。

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM