Could not find method on interface org.apache.ibatis.executor.statement.StatementHandler

轉自:https://www.cnblogs.com/EasonJim/p/7056700.html

MyBatis3.4.0以上的分頁插件錯誤:Could not find method on interface org.apache.ibatis.executor.statement.StatementHandler named prepare. Cause: java.lang.NoSuchMethodException: org.apache.ibatis.executor.stateme

錯誤:

Could not find method on interface org.apache.ibatis.executor.statement.StatementHandler named prepare. Cause: java.lang.NoSuchMethodException: org.apache.ibatis.executor.statement.StatementHandler.prepare(java.sql.Connection)] with root cause

問題解決:

其實這個是版本更新之後,官方取消了這個函數,轉而升級了兩個參數的方法,改動如下:

@Intercepts({ @Signature(type = StatementHandler.class, method = "prepare", args = { Connection.class, Integer.class }) })

官方的解釋如下:

In 3.4.0, StatementHandler#prepare(Connection) has been changed to StatementHandler#prepare(Connection,Integer).

See https://github.com/mybatis/mybatis-3/blob/master/src/main/java/org/apache/ibatis/executor/statement/StatementHandler.java#L33-L34 .

參考:

https://github.com/mybatis/mybatis-3/issues/645


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章