在config中配置性能分析插件
//性能分析插件 /** * SQL 执行性能分析插件 * 开发环境使用,线上不推荐。 */ @Bean @Profile({"dev","test"})// 设置 dev test 环境开启 public MybatisPlusInterceptor performanceInterceptor() { MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor(); interceptor.addInnerInterceptor(new IllegalSQLInnerInterceptor()); return interceptor; }
在application.properties中设置环境
# 环境设置为dev spring.profiles.active=dev
遗憾的是,在新的mybatis-plus中该插件已经被移除了。