Example usage for org.springframework.web.reactive.function.client WebClient mutate

List of usage examples for org.springframework.web.reactive.function.client WebClient mutate

Introduction

In this page you can find the example usage for org.springframework.web.reactive.function.client WebClient mutate.

Prototype

Builder mutate();

Source Link

Document

Return a builder to create a new WebClient whose settings are replicated from the current WebClient .

Usage

From source file:org.springframework.cloud.sleuth.instrument.web.client.TraceWebClientBeanPostProcessor.java

@Override
public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
    if (bean instanceof WebClient) {
        WebClient webClient = (WebClient) bean;
        return webClient.mutate().filters(addTraceExchangeFilterFunctionIfNotPresent()).build();
    } else if (bean instanceof WebClient.Builder) {
        WebClient.Builder webClientBuilder = (WebClient.Builder) bean;
        return webClientBuilder.filters(addTraceExchangeFilterFunctionIfNotPresent());
    }//from   w w w .  j av a 2 s. com
    return bean;
}