拦截器的执行顺序

翻看源码: registry.addInterceptor()

    public InterceptorRegistration addInterceptor(HandlerInterceptor interceptor) {
        InterceptorRegistration registration = new InterceptorRegistration(interceptor);
        this.registrations.add(registration);
        return registration;
    }

image

其中 order 的值越大执行的优先级越低

例如:registry.addInterceptor(new RefreshTokenInterceptor(stringRedisTemplate)).addPathPatterns("/**").order(0);

posted @ 2024-06-21 10:26  捞月亮的小北  阅读(2)  评论(0编辑  收藏  举报