mybatis|pagehelper升级出现ClassCastException

最近把一个老项目升级,出现了很多异常和问题,做个记录:Caused by: java.lang.ClassCastException: class com.github.pagehelper.PageHelper cannot be cast to class org.apache.ibatis.plugin.Interceptor

Caused by: java.lang.ClassCastException: class com.github.pagehelper.PageHelper cannot be cast to class org.apache.ibatis.plugin.Interceptor (com.github.pagehelper.PageHelper and org.apache.ibatis.plugin.Interceptor are in unnamed module of loader org.apache.catalina.loader.ParallelWebappClassLoader @4492aa31)

类型转换异常,由于是把pagehelper.jar的版本从4.0.3升级到5.2.0引起,发现源码存在改动,原来的PageHelper已经没有实现Interceptor 接口了,难怪类型转换异常,取而代之的是PageInterceptor,修改mybatis-config.xml的配置文件即可

将原来的【mybatis|pagehelper升级出现ClassCastException】换成 即可。
可能会出现的问题Caused by: com.github.pagehelper.PageException: java.lang.ClassNotFoundException: mysql
这是因为高版本可以无需指定dialect,自动识别,将该配置去除即可

    推荐阅读