package com.jy.framework.filter;

import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * Filter配置
 */
@Configuration
public class FilterConfig {

    /**
     * 构建可重复读取inputStream的request
     */
    @Bean
    public FilterRegistrationBean<RepeatableFilter> repeatableFilterRegistrationBean() {
        FilterRegistrationBean<RepeatableFilter> bean = new FilterRegistrationBean<>();
        bean.setFilter(new RepeatableFilter());
        bean.addUrlPatterns("/*");
        bean.setOrder(FilterRegistrationBean.HIGHEST_PRECEDENCE);
        return bean;
    }

}
