springboot+mybatis|myabtis plus+pageHelper 整合

1.添加依赖

 
    com.github.pagehelper
    pagehelper
    5.1.10


  
     
    org.mybatis.spring.boot
    mybatis-spring-boot-starter
    2.0.1
 


      com.baomidou
      mybatis-plus-boot-starter
      3.1.1
   


2.配置PageHelper

@Configuration
public class MybatisPangeHelperConfig {

	
	  @Bean 
	  public PageInterceptor pageInterceptor(){ 
		  PageInterceptor  pageInterceptor = new PageInterceptor(); 
		  Properties properties = new   Properties(); 
		  properties.setProperty("reasonable","true");
	    pageInterceptor.setProperties(properties); 
	    return pageInterceptor; 
	  }
	  
	 

}

遇到的问题:

在mybatis-config.xml中配置分页插件,
   启动类通过@ImportResource(locations = { "mybatis/mybatis-config.xml"})
  方式自动装配无效,分页信息不对;

你可能感兴趣的:(springboot)