package com;

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.WebMvcConfigurationSupport;

//@Configuration
public class InterceptorConfig extends WebMvcConfigurationSupport {

	@Bean
	public LogercostInterceptor getInterceptor() {
		return new LogercostInterceptor();
	}
	/**
     * interceptor配置
     */
    @Override
    public void addInterceptors(InterceptorRegistry registry) {

    	//添加需要验证登录用户操作权限的请求
        registry.addInterceptor(getInterceptor()).addPathPatterns("/**");

        //这里可以用registry.addInterceptor添加多个拦截器实例，后面加上匹配模式
        //super.addInterceptors(registry);//最后将register往这里塞进去就可以了
    }
}
