SpringBoot、mysql配置PageHelper插件
一: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版本:
<parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>2.0.4.RELEASE</version> <relativePath/> <!-- lookup parent from repository --></parent>
pageHelper版本:
<dependency> <groupId>com.github.pagehelper</groupId> <artifactId>pagehelper-spring-boot-starter</artifactId> <version>1.2.5</version></dependency> 二:https://blog.csdn.net/s592652578/article/details/78179998 主要异常信息:com.github.pagehelper.PageHelper cannot be cast to org.apache.ibatis.plugin.Interceptor我的配置
<plugins>
<plugin interceptor="com.github.pagehelper.PageHelper">
<!-- 设置数据库类型 Oracle,Mysql,MariaDB,SQLite,Hsqldb,PostgreSQL六种数据库-->
<property name="dialect" value="mysql"/>
</plugin>
</plugins>
解决:配置中实现的是com.github.pagehelper.PageHelper这个接口,而错误报的是这个借口在强转成org.apache.ibatis.plugin.Interceptor这个借口的时候报错了,而我使用的是pageheper5.1.2版本,上网一查,自4.0.0版本以后就不再实现这个接口了,转而实现这个接口:org.apache.ibatis.plugin.Interceptor,因此,修改配置如下:
<plugins> <plugin interceptor="com.github.pagehelper.PageInterceptor"> <!-- 设置数据库类型 Oracle,Mysql,MariaDB,SQLite,Hsqldb,PostgreSQL六种数据库--> <property name="dialect" value="mysql"/> </plugin></plugins> 又报异常:主要是mysql类不识别,最终原因还是因为版本的问题,自4.0.0以后的版本已经可以自动识别数据库了,所以不需要我们再去指定数据库,所以,修改配置:
<plugins> <plugin interceptor="com.github.pagehelper.PageInterceptor"> </plugin></plugins>
三:之后的异常:java.lang.RuntimeException: 在系统中发现了多个分页插件,请检查系统配置!删除mybatis-config.xml文件中的pagehelper就好了
<!--<plugins>--> <!--<!– com.github.pagehelper为PageHelper类所在包名 –>--> <!--<plugin interceptor="com.github.pagehelper.PageInterceptor">--> <!--</plugin>--><!--</plugins>--> https://blog.csdn.net/boke7265/article/details/80863010 总结:SpringBoot、mysql配置PageHelper插件,只需要使用 2.0.4.RELEASE版本SpringBoot引入1.2.5版本pageHelper即可。
转载于:https://www.cnblogs.com/zhangliwei/p/9575867.html
SpringBoot、mysql配置PageHelper插件相关推荐
- 在项目中配置PageHelper插件时遇到类型转换异常
在项目中配置PageHelper插件时遇到类型转换异常 参考文章: (1)在项目中配置PageHelper插件时遇到类型转换异常 (2)https://www.cnblogs.com/dubhlinn ...
- Springboot—mysql+mybatis+generator插件
1.idea-generatorConfig.xml <?xml version="1.0" encoding="UTF-8"?> <!DOC ...
- springboot+mybatis 利用PageHelper插件分页,结果第二页的返回分页信息还是和第一页一样。
正常使用PageHelper来分页时可以的,但是如果在查询list后做了非常多的处理,即解包在装包操作.可能最后返回时分页的数据查询的对,但是分页信息就有问题了.有的甚至分页功能都不行.这里为避免几个 ...
- .jar中没有主清单属性_如何在springboot中使用PageHelper分页插件
目录: PageHelper简介 使用maven引入相关的jar 配置PageHelper方言 编写业务逻辑代码 PageInfo类中几个常用属性的注释 一. PageHelper简介 PageHel ...
- springboot进阶,分页插件 pageHelper,Swagger整合,日志
文章目录 1,课程回顾 2,本章重点 3,具体内容 3.1 整合连接池 3.2 springboot日志配置: 3.3 springboot整合shiro 3.4 mybatis分页插件 pageHe ...
- java+spring+mysql配置_JAVA后台搭建(springboot+mybatis+mysql)项目搭建
前言 上篇文章写了基本环境配置的搭建,接下来我们需要搭建项目了,项目搭建使用的IDEA,springboot项目的搭建非常快只需要几分钟,然后介绍MyBatis以及MySql的基本配置以及项目的Hel ...
- SpringBoot MySql Druid配置主从数据源(多个数据源)
1 . POM依赖 <!--mybatis依赖 --> <dependency><groupId>mysql</groupId><artifact ...
- mysql异常插件_【异常】诡异的mysql错误,Pagehelper插件混乱导致吗
1 详细的异常信息 Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in ...
- SpringBoot + Mybatis + Druid + PageHelper 实现多数据源并分页
点击关注公众号,Java干货及时送达 本篇文章主要讲述的是SpringBoot整合Mybatis.Druid和PageHelper 并实现多数据源和分页.其中SpringBoot整合Mybatis这块 ...
最新文章
- 计算机系统的基本功能,计算机系统的主要功能是什么
- 天津工业大学19年计算机考研大纲,2019年天津工业大学《计算机原理及接口技术》考研复试大纲...
- 蚂蚁金服CTO鲁肃:支付宝成就了我,我做了很多“拧螺丝”的事儿
- dcdc模块降额设计_模块电源应用设计的可靠性和注意事项
- ASP.NET Core 实现基于 ApiKey 的认证
- YL杯超级篮球赛(jzoj 1325)
- 点云数据生成三维模型_可直接编辑的高质量3D生成模型:三维深度生成方法SDM-NET...
- python判断_python的判断
- NAT(NAPT)地址转换过程
- python爬取抖音用户数据的单位是_爬取并分析一下B站的最热视频排行榜,看看大家都喜欢看什么视频...
- java 动态树_使用dtree构建动态树型菜单
- cocos2d-x 2.0版本 自适应屏幕分辨率 .
- Elasticsearch聚合 之 Histogram 直方图聚合
- 2020年面向前端开发人员的10个很棒的 JS 库
- 最佳和最快的游戏 DNS 服务器
- 玩拍七不再怕,判断7的倍数有妙招
- 字体图标iconfont的使用
- 使用exe4j打包exe文件
- Component Xxx is not part of any NgModule or the module has not been imported into your module.
- 苹果微信浏览器html缓存图片吗,h5清理微信浏览器网页缓存
热门文章
- Bash shell 学习笔记六
- C#中的thread和task之Task
- nginx cache 配置
- 未来人口出现负增长后,我国的房价何去何从?
- 贷款被拒,因为你的征信黑洞太多
- 年化利息100%,现金贷监管寒冬将至
- 推荐几个机器学习算法及应用领域相关的中国大牛:
- C++的int初始化
- mendeley引用参考文献不显示_免费文献管理器Mendeley
- python3中异常处理_python中的五种异常处理机制介绍|python3教程|python入门|python教程...