一、ResourcesConfig
通过 以下添加拦截器 HandlerInterceptor的实现类PlusWebInvokeTimeInterceptor:
类位置 com.ruoyi.framework.config.ResourcesConfig 功能 实现了WebMvcConfigurer接口,就可以实现开发环境请求时间统计 registry.addInterceptor(new PlusWebInvokeTimeInterceptor());下面先看下PlusWebInvokeTimeInterceptor实现(注释已经标明逻辑):
/**
* web的调用时间统计拦截器
* dev环境有效
*/
@Slf4j
public class PlusWebInvokeTimeInterceptor implements HandlerInterceptor {
private final String prodProfile = "prod";
//1-创建线程局部变量,切换线程时候也能传递
private final TransmittableThreadLocal<StopWatch> invokeTimeTL = new TransmittableThreadLocal<>();
//2-前置处理
@Override
public b