package com.cm.common.config;

import com.cm.common.filter.AppFilter;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * When you feel like quitting. Think about why you started
 * 当你想要放弃的时候，想想当初你为何开始
 *
 * @ClassName: FilterConfig
 * @Description: 过滤器控制
 * @Author: WangGeng
 * @Date: 2019-08-01 14:08
 * @Version: 1.0
 **/
@Configuration
public class FilterConfig {

    @Bean
    public FilterRegistrationBean appFilterRegister() {
        FilterRegistrationBean filterRegistrationBean = new FilterRegistrationBean();
        filterRegistrationBean.setFilter(new AppFilter());
        filterRegistrationBean.addUrlPatterns("/app/*", "/approute/*");
        filterRegistrationBean.setName("appFilter");
        filterRegistrationBean.setOrder(1);
        return filterRegistrationBean;
    }

}
