(傲娇的白狐)Mybatis-plus性能分析插件 监控插件

Mybatis-plus性能分析插件 监控插件

用处:

可以查看sql运行情况,限定时间 超出会报异常。可以以此进行优化

在 yml文件栏 是指开发环境

# 性能分析插件配置
spring.profiles.active=dev

使用:

配置环境: 就行了 可以直接运行来查看

// 性能分析
@Bean
@Profile({"dev","test"}) // 设置 dev test 环境开启 保证我们的效率
public PerformanceInterceptor performanceInterceptor(){

PerformanceInterceptor performanceInterceptor = new PerformanceInterceptor();

performanceInterceptor.setMaxTime(100); // 设置sql最大执行时间 ,超过了不执行
performanceInterceptor.setFormat(true);//
return performanceInterceptor;
}

 

测试:

performanceInterceptor.setMaxTime(20);设为20

 

 超出设置

 

posted @ 2020-07-19 14:54  傲娇的白狐  阅读(777)  评论(0)    收藏  举报