package com.ywt.mg.web.configs;

import com.ywt.mg.core.SpringContext;
import com.ywt.mg.web.interceptors.AccessBehaviorInterceptor;
import com.ywt.mg.web.interceptors.AuthInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

/**
 * Created by huangguoping.
 */
@Configuration
public class WebMvcConfigurer extends WebMvcConfigurerAdapter {
    @Override
    public void addInterceptors(InterceptorRegistry registry) {

        registry.addInterceptor((AccessBehaviorInterceptor) SpringContext.getBean(AccessBehaviorInterceptor.class)).addPathPatterns("/**");
        registry.addInterceptor((AuthInterceptor) SpringContext.getBean(AuthInterceptor.class)).addPathPatterns("/**");
        super.addInterceptors(registry);
    }
}
