liujie
2026-06-09 c96fbe6b0aeb413a17c429133ee6d81d138144b9
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package com.xiaopeng.automaticPilot.config.log;
 
import com.xiaopeng.unifiedverification.interceptor.CheckForClientInterceptor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Lazy;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
 
@Slf4j
@Configuration
public class WebMvcConfigurer implements org.springframework.web.servlet.config.annotation.WebMvcConfigurer {
 
    @Autowired
    private LogInterceptor logInterceptor;
 
    @Autowired
    @Lazy
    private CheckForClientInterceptor checkForClientInterceptor;
 
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        // 日志拦截器,拦截所有请求,初始化 MDC(traceId、IP、URI)
        registry.addInterceptor(logInterceptor).addPathPatterns("/**");
        // 统一验证服务拦截器
        registry.addInterceptor(checkForClientInterceptor).addPathPatterns("/vehicle/v1/**")
                .excludePathPatterns("/**/6998f6d9-5a10-4aab-b7d5-4855e710ba7d");
    }
 
}