package com.gyee.wisdom.alarm.sharding.config;

import com.gyee.wisdom.alarm.sharding.filter.LoginInterceptor;
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;

/**
 * @descrition:
 * @author:Wanghs
 * @date:2020-05-21
 */
@Configuration
public class InterceptorConfig  implements  WebMvcConfigurer {

    @Bean
    LoginInterceptor loginInterceptor() {
        return new LoginInterceptor();
    }

    /**
     * @Function: 配置生成器：添加一个拦截器，拦截路径为login以后的路径
     * @author:   YangXueFeng
     * @Date:     2019/4/14 13:10
     */
    @Override
    public void addInterceptors(InterceptorRegistry registry ) {
        registry.addInterceptor(loginInterceptor()).addPathPatterns("/**").excludePathPatterns("/login", "/register", "/static");

    }
}
