package com.ssj.sys.interceptor;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.*;



@Configuration
@EnableWebMvc
public class RegisterInterceptor extends WebMvcConfigurerAdapter {
	 
	 @Autowired
	 private   LoginInterceptor    loginInterceptor;
	 

	     @Override
	    public void addResourceHandlers(ResourceHandlerRegistry registry) {
	        //将所有/static/** 访问都映射到classpath:/static/ 目录下
	        registry.addResourceHandler("/static/**").addResourceLocations("classpath:/static/");

	    }
	    @Override
	    public void addInterceptors(InterceptorRegistry  registry) {
	    	InterceptorRegistration addInterceptor = registry.addInterceptor(loginInterceptor);
	    	// 排除配置
	    	addInterceptor.excludePathPatterns("/static/**");
	    	addInterceptor.excludePathPatterns("classpath:/static/");

	    	// 拦截配置
	    	addInterceptor.addPathPatterns("/sys/**");
	    }
	    
}
