谷粒学院项目实战19——mp对sql性能分析
在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中该插件已经被移除了。
java全栈日日学 文章被收录于专栏
java全栈每日必学,不要高估自己一年能做的事,不要低估自己十年能做的事