package com.zanxiang.game.data.serve.config;

import com.zanxiang.game.data.serve.intercept.WebVisitLogIntercept;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class CheckConfig implements WebMvcConfigurer {

    @Bean
    public WebVisitLogIntercept getRequestInterceptor(){
        return  new WebVisitLogIntercept();
    }


    @Override
    public void addInterceptors(InterceptorRegistry registry) {

        registry.addInterceptor(getRequestInterceptor())
                .addPathPatterns("/**")
                .excludePathPatterns("/swagger-ui.html/**");
    }
}
