pom文件
<!-- MyBatis-Plus -->
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>3.1.1</version>
</dependency>
配置文件
@Configuration
@ConditionalOnClass(value = {PaginationInterceptor.class})
//mapper路径
@MapperScan("com.mapper")
public class MyBatisPlusConfig {
//分页插件配置
@Bean("paginationInterceptor")
public PaginationInterceptor paginationInterceptor() {
PaginationInterceptor paginationInterceptor = new PaginationInterceptor();
return paginationInterceptor;
}
//打印具体执行sql以及运行时间和执行的方法路径
@Bean("performanceInterceptor")
public PerformanceInterceptor performanceInterceptor() {
return new PerformanceInterceptor();
}
}
具体使用去官网看即可,写的很详细