package com.lingyue.config;

import com.lingyue.config.interceptor.RequestParameterLoggingInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * HTTP请求参数日志记录配置
 *
 * @author lingyue
 */
@Configuration
public class RequestParameterLoggingConfig implements WebMvcConfigurer {

    @Autowired
    private RequestParameterLoggingInterceptor requestParameterLoggingInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(requestParameterLoggingInterceptor)
                .addPathPatterns("/**")
                .excludePathPatterns(
                        "/swagger-ui/**",
                        "/api-docs/**",
                        "/v3/api-docs/**",
                        "/webjars/**",
                        "/error",
                        "/favicon.ico",
                        "/ws/**"
                );
    }
}

