package com.cirle.scientific.config;

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 CirleConfigurer implements WebMvcConfigurer {
    @Bean
    public CirleInterceptor getInterceptor(){
        return new CirleInterceptor();
    }

    @Override
    public void addInterceptors(InterceptorRegistry registry) {

        /**
         * 自定义拦截器，添加拦截路径和排除拦截路径
         * addPathPatterns():添加需要拦截的路径
         */
        registry.addInterceptor(getInterceptor()).addPathPatterns("/**");
    }
}
