package com.house365.common;

import com.house365.config.HgsProp;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

/**
 * Description
 * <p>
 * Created by 365 on 2017/3/21 0021.
 */
@EnableWebMvc
@Configuration
public class WeChatConfigurer extends WebMvcConfigurerAdapter {

    @Autowired
    private HgsProp hgsProp;
    @Autowired
    private RedisTemplate redisTemplate;

    /**
     * 配置拦截器
     *
     * @param registry
     * @author lance
     */
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new ExCludeInterceptor())
                .excludePathPatterns("/**");
        registry.addInterceptor(new WeChatInterceptor(hgsProp, redisTemplate))
                .addPathPatterns("/project/**", "/customer/**", "/customer/addcustomer/**", "/user/evaluateUser/**");

    }
}
