谷粒学院项目实战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全栈每日必学,不要高估自己一年能做的事,不要低估自己十年能做的事

全部评论

相关推荐

大摆哥:刚好要做个聊天软件,直接让你帮他干活了
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客企业服务