|
@@ -7,7 +7,6 @@ import java.util.Map;
|
|
import java.util.Objects;
|
|
import java.util.Objects;
|
|
import java.util.Set;
|
|
import java.util.Set;
|
|
import java.util.function.Predicate;
|
|
import java.util.function.Predicate;
|
|
-import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
import com.chelvc.framework.base.config.MultiserverMvcConfigurer;
|
|
import com.chelvc.framework.base.config.MultiserverMvcConfigurer;
|
|
import com.chelvc.framework.base.context.Session;
|
|
import com.chelvc.framework.base.context.Session;
|
|
@@ -26,7 +25,6 @@ import feign.Target;
|
|
import lombok.NonNull;
|
|
import lombok.NonNull;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import org.springframework.context.ApplicationContext;
|
|
import org.springframework.context.ApplicationContext;
|
|
-import org.springframework.core.env.Environment;
|
|
|
|
import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping;
|
|
import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping;
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -51,7 +49,6 @@ public class FeignInvokeInterceptor implements RequestInterceptor {
|
|
this.mappings = ObjectUtils.isEmpty(mappings) ? Collections.emptyMap() : (Map<String, ?>) mappings;
|
|
this.mappings = ObjectUtils.isEmpty(mappings) ? Collections.emptyMap() : (Map<String, ?>) mappings;
|
|
|
|
|
|
// 初始化请求转发配置
|
|
// 初始化请求转发配置
|
|
- Environment environment = applicationContext.getEnvironment();
|
|
|
|
FeignProperties properties = applicationContext.getBean(FeignProperties.class);
|
|
FeignProperties properties = applicationContext.getBean(FeignProperties.class);
|
|
List<FeignProperties.Forward> forwards = Lists.newArrayList(properties.getForwards());
|
|
List<FeignProperties.Forward> forwards = Lists.newArrayList(properties.getForwards());
|
|
if (applicationContext.containsBean(MultiserverMvcConfigurer.class.getName())
|
|
if (applicationContext.containsBean(MultiserverMvcConfigurer.class.getName())
|
|
@@ -61,16 +58,7 @@ public class FeignInvokeInterceptor implements RequestInterceptor {
|
|
forward.setPrefixed(true);
|
|
forward.setPrefixed(true);
|
|
forwards.add(forward);
|
|
forwards.add(forward);
|
|
}
|
|
}
|
|
- this.forwards = forwards.isEmpty() ? Collections.emptyList() : forwards.stream().map(forward -> {
|
|
|
|
- FeignProperties.Forward copy = new FeignProperties.Forward();
|
|
|
|
- copy.setSource(forward.getSource());
|
|
|
|
- copy.setTarget(forward.getTarget());
|
|
|
|
- copy.setPrefixed(forward.isPrefixed());
|
|
|
|
- if (StringUtils.notEmpty(copy.getTarget())) {
|
|
|
|
- copy.setTarget(environment.resolvePlaceholders(copy.getTarget()));
|
|
|
|
- }
|
|
|
|
- return copy;
|
|
|
|
- }).collect(Collectors.toList());
|
|
|
|
|
|
+ this.forwards = ObjectUtils.isEmpty(forwards) ? Collections.emptyList() : forwards;
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|