PageHelper-Spring-Boot-Starter 帮助你集成分页插件到 Spring Boot。
PageHelper-Spring-Boot-Starter will help you use PageHelper with Spring Boot.
Support PageHelper 6.x
在 pom.xml 中添加如下依赖:
Add the following dependency to your pom.xml:
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper-spring-boot-starter</artifactId>
<version>2.1.0</version>
</dependency>
orderBySqlParser
,OrderBySqlParser
改为接口,允许通过orderBySqlParser
参数替换为自己的实现sqlServerSqlParser
,SqlServerSqlParser
改为接口,允许通过sqlServerSqlParser
参数替换为自己的实现CountSqlParser
,OrderBySqlParser
,SqlServerSqlParser
还支持SPI方式覆盖默认实现,优先级低于参数指定asyncCount
,增加异步count支持,默认false
,单次设置:PageHelper.startPage(1, 10).enableAsyncCount()
;countSqlParser
,CountSqlParser
改为接口,允许通过countSqlParser
参数替换为自己的实现参数示例:
pagehelper.async-count=true
autoDialectClass
参数,详情看 PageHelper 更新日志PageHelperAutoConfiguration
使用 InitializingBean
接口代替 @PostConstruct
注解PageHelperAutoConfiguration
增加 @Lazy(false)
注解,当配置延迟加载时,避免分页插件出错v1.2.8 由于未修改版本,仍然和 v1.2.7 相同。
;
隔开):pagehelper.dialect-alias=oracle=com.github.pagehelper.dialect.helper.OracleDialect
pagehelper.default-count=false
PageHelperAutoConfiguration
类中的 @Override
报错问题。一般情况下,你不需要做任何配置。
Normally, you don't need to do any configuration.
如果需要配置,可以使用如下方式进行配置:
You can config PageHelper as the following:
application.properties:
pagehelper.propertyName=propertyValue
注意 pagehelper 配置,因为分页插件根据自己的扩展不同,支持的参数也不同,所以不能用固定的对象接收参数,所以这里使用的 Map<String,String>
,因此参数名是什么这里就写什么,IDE 也不会有自动提示。
关于可配置的属性请参考 如何使用分页插件。
You can configure the properties of the reference here How to use the PageHelper.
如果你想要控制 拦截器插件的顺序,可以通过下面注解控制:
If you want to control the order in which the interceptor plug-in, you can use the following annotation control:
@AutoConfigureAfter(PageHelperAutoConfiguration.class)
//Or
@AutoConfigureBefore(PageHelperAutoConfiguration.class)
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。