|
|
@ -3,13 +3,11 @@ package com.chanko.yunxi.mes.heli.framework.web.config;
|
|
|
|
import com.chanko.yunxi.mes.heli.framework.apilog.core.service.ApiErrorLogFrameworkService;
|
|
|
|
import com.chanko.yunxi.mes.heli.framework.apilog.core.service.ApiErrorLogFrameworkService;
|
|
|
|
import com.chanko.yunxi.mes.heli.framework.common.enums.WebFilterOrderEnum;
|
|
|
|
import com.chanko.yunxi.mes.heli.framework.common.enums.WebFilterOrderEnum;
|
|
|
|
import com.chanko.yunxi.mes.heli.framework.web.core.filter.CacheRequestBodyFilter;
|
|
|
|
import com.chanko.yunxi.mes.heli.framework.web.core.filter.CacheRequestBodyFilter;
|
|
|
|
import com.chanko.yunxi.mes.heli.framework.web.core.filter.DemoFilter;
|
|
|
|
|
|
|
|
import com.chanko.yunxi.mes.heli.framework.web.core.handler.GlobalExceptionHandler;
|
|
|
|
import com.chanko.yunxi.mes.heli.framework.web.core.handler.GlobalExceptionHandler;
|
|
|
|
import com.chanko.yunxi.mes.heli.framework.web.core.handler.GlobalResponseBodyHandler;
|
|
|
|
import com.chanko.yunxi.mes.heli.framework.web.core.handler.GlobalResponseBodyHandler;
|
|
|
|
import com.chanko.yunxi.mes.heli.framework.web.core.util.WebFrameworkUtils;
|
|
|
|
import com.chanko.yunxi.mes.heli.framework.web.core.util.WebFrameworkUtils;
|
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
|
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
|
|
|
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
|
|
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
|
|
|
|
|
|
|
import org.springframework.boot.autoconfigure.web.client.RestTemplateAutoConfiguration;
|
|
|
|
import org.springframework.boot.autoconfigure.web.client.RestTemplateAutoConfiguration;
|
|
|
|
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
|
|
|
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
|
|
|
import org.springframework.boot.web.client.RestTemplateBuilder;
|
|
|
|
import org.springframework.boot.web.client.RestTemplateBuilder;
|
|
|
@ -101,15 +99,6 @@ public class MesWebAutoConfiguration implements WebMvcConfigurer {
|
|
|
|
return createFilterBean(new CacheRequestBodyFilter(), WebFilterOrderEnum.REQUEST_BODY_CACHE_FILTER);
|
|
|
|
return createFilterBean(new CacheRequestBodyFilter(), WebFilterOrderEnum.REQUEST_BODY_CACHE_FILTER);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 创建 DemoFilter Bean,演示模式
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
@Bean
|
|
|
|
|
|
|
|
@ConditionalOnProperty(value = "mes.demo", havingValue = "true")
|
|
|
|
|
|
|
|
public FilterRegistrationBean<DemoFilter> demoFilter() {
|
|
|
|
|
|
|
|
return createFilterBean(new DemoFilter(), WebFilterOrderEnum.DEMO_FILTER);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static <T extends Filter> FilterRegistrationBean<T> createFilterBean(T filter, Integer order) {
|
|
|
|
public static <T extends Filter> FilterRegistrationBean<T> createFilterBean(T filter, Integer order) {
|
|
|
|
FilterRegistrationBean<T> bean = new FilterRegistrationBean<>(filter);
|
|
|
|
FilterRegistrationBean<T> bean = new FilterRegistrationBean<>(filter);
|
|
|
|
bean.setOrder(order);
|
|
|
|
bean.setOrder(order);
|
|
|
|