package com.persagy.calendar.config;

import java.util.ArrayList;
import java.util.List;

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;

import com.persagy.calendar.aop.UserAgentInterceptor;

/**
 * 
 * @version 1.0.0
 * @company persagy 
 * @author zhangqiankun
 * @date 2022年3月21日 下午6:30:44
 */
@Configuration
public class WebMvcConfig implements WebMvcConfigurer {

	@Autowired
	private UserAgentInterceptor userAgentInterceptor;
	
    public static final List<String> excludePaths = new ArrayList<String>();
    static {
    	excludePaths.add("/v2.0/common/handleParseCalendarRule/**");
    }
	
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(userAgentInterceptor).addPathPatterns("/**").excludePathPatterns(excludePaths);
    }
	
}
