package com.usky.website.service.config.interceptor;


import com.usky.website.interceptor.RedisInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

//@Configuration告诉springboot这个类为配置类
@Configuration
public class WebConfig implements WebMvcConfigurer {

    //从容器中取出RedisInterceptor
    @Autowired
    RedisInterceptor redisInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        //注册拦截器
        registry.addInterceptor(redisInterceptor)
                .addPathPatterns("/siteArticle/siteArticleList");  //设置拦截路径， “/**”表示对所有请求都进行拦截
//                .excludePathPatterns("/static");   //设置不拦截的路径，一般可以设置静态资源的访问路径....
    }
}
