Polish
This commit is contained in:
@@ -75,16 +75,19 @@ final class TraceWebClientBeanPostProcessor implements BeanPostProcessor {
|
||||
throws BeansException {
|
||||
if (bean instanceof WebClient) {
|
||||
WebClient webClient = (WebClient) bean;
|
||||
return webClient.mutate()
|
||||
.filters(addTraceExchangeFilterFunctionIfNotPresent()).build();
|
||||
return wrapBuilder(webClient.mutate()).build();
|
||||
}
|
||||
else if (bean instanceof WebClient.Builder) {
|
||||
WebClient.Builder webClientBuilder = (WebClient.Builder) bean;
|
||||
return webClientBuilder.filters(addTraceExchangeFilterFunctionIfNotPresent());
|
||||
return wrapBuilder(webClientBuilder);
|
||||
}
|
||||
return bean;
|
||||
}
|
||||
|
||||
private WebClient.Builder wrapBuilder(WebClient.Builder webClientBuilder) {
|
||||
return webClientBuilder.filters(addTraceExchangeFilterFunctionIfNotPresent());
|
||||
}
|
||||
|
||||
private Consumer<List<ExchangeFilterFunction>> addTraceExchangeFilterFunctionIfNotPresent() {
|
||||
return functions -> {
|
||||
if (functions.stream()
|
||||
|
||||
Reference in New Issue
Block a user