package quant.rich.emoney.config;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;


import quant.rich.emoney.interceptor.BaseInterceptor;
import quant.rich.emoney.interceptor.EnumOptionsInterceptor;
import quant.rich.emoney.service.ConfigService;

/**
 * Emoney-Auto 配置项
 * 
 * @author Doghole
 *
 */
@Configuration
@Import(ConfigAutoRegistrar.class)
public class EmoneyAutoConfig implements WebMvcConfigurer {

    @Autowired
    BaseInterceptor baseInterceptor;
    
    @Autowired
    EnumOptionsInterceptor enumOptionsInterceptor;

    @Autowired
    ConfigService configService;

    /**
     * 简单鉴权/配置项注入拦截器
     * 
     * @param registry
     */
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(baseInterceptor).addPathPatterns("/**");
        registry.addInterceptor(enumOptionsInterceptor).addPathPatterns("/**");
    }
}
