方法一:在main方法Application中配置
@Bean PageHelper pageHelper(){ //分页插件 PageHelper pageHelper = new PageHelper(); Properties properties = new Properties(); properties.setProperty("reasonable", "true"); properties.setProperty("supportMethodsArguments", "true"); properties.setProperty("returnPageInfo", "check"); properties.setProperty("params", "count=countSql"); pageHelper.setProperties(properties); //添加插件 不添加分页无效果 new SqlSessionFactoryBean().setPlugins(new Interceptor[]{pageHelper}); return pageHelper; }
方法二:在application.properties里配置
#pagehelper pagehelper.helper-dialect=mysql pagehelper.reasonable=true pagehelper.support-methods-arguments=true pagehelper.params=count=countSql
--