package com.ywt.outpatient.configs;

import com.ywt.outpatient.core.SpringContext;
import com.ywt.outpatient.interceptors.AccessBehaviorInterceptor;
import com.ywt.outpatient.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);
    }
}
