package quant.rich.emoney.config;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.EnableAspectJAutoProxy;
import org.springframework.context.annotation.Import;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;


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

/**
 * Emoney-Auto 配置项
 * 
 * @author Doghole
 *
 */
@Configuration
@EnableAsync(proxyTargetClass=true)
@EnableCaching(proxyTargetClass=true)
@EnableAspectJAutoProxy(exposeProxy = true, proxyTargetClass = true)
@Import(ConfigAutoRegistrar.class)
public class EmoneyAutoConfig implements WebMvcConfigurer {
    
    @Autowired
    EnumOptionsInterceptor enumOptionsInterceptor;

    @Autowired
    ConfigService configService;

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