一:https://blog.csdn.net/h985161183/article/details/79800737
主要异常:org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.github.pagehelper.autoconfigure.PageHelperAutoConfiguration':
pageHelper.jar版本与MyBatis版本不兼容;换用高版本jar包
我用的SpringBoot版本:
org.springframework.boot
spring-boot-starter-parent
2.0.4.RELEASE
pageHelper版本:
com.github.pagehelper
pagehelper-spring-boot-starter
1.2.5
二:https://blog.csdn.net/s592652578/article/details/78179998
主要异常信息:com.github.pagehelper.PageHelper cannot be cast to org.apache.ibatis.plugin.Interceptor
我的配置
解决:配置中实现的是com.github.pagehelper.PageHelper这个接口,而错误报的是这个借口在强转成org.apache.ibatis.plugin.Interceptor这个借口的时候报错了,而我使用的是pageheper5.1.2版本,上网一查,自4.0.0版本以后就不再实现这个接口了,转而实现这个接口:org.apache.ibatis.plugin.Interceptor,因此,修改配置如下:
又报异常:主要是mysql类不识别,最终原因还是因为版本的问题,自4.0.0以后的版本已经可以自动识别数据库了,所以不需要我们再去指定数据库,所以,修改配置:
三:之后的异常:java.lang.RuntimeException: 在系统中发现了多个分页插件,请检查系统配置!
删除mybatis-config.xml文件中的pagehelper就好了
https://blog.csdn.net/boke7265/article/details/80863010
总结:SpringBoot、mysql配置PageHelper插件,只需要使用 2.0.4.RELEASE版本SpringBoot引入1.2.5版本pageHelper即可。