org.springframework.boot.web.reactive.function.client.WebClientCustomizer Java Examples

The following examples show how to use org.springframework.boot.web.reactive.function.client.WebClientCustomizer. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: WebClientBraveTests.java    From spring-cloud-sleuth with Apache License 2.0 5 votes vote down vote up
/**
 * Normally, the HTTP connector would be statically initialized. This ensures the
 * {@link HttpClient} is configured for the mock endpoint.
 */
@Bean
@Order(0)
public WebClientCustomizer clientConnectorCustomizer(HttpClient httpClient,
		URI baseUrl) {
	return (builder) -> builder.baseUrl(baseUrl.toString())
			.clientConnector(new ReactorClientHttpConnector(httpClient));
}
 
Example #2
Source File: ReactiveWebClientBuilderInitializer.java    From spring-fu with Apache License 2.0 4 votes vote down vote up
@Override
public void initialize(GenericApplicationContext context) {
	context.registerBean(WebClient.Builder.class, () -> new WebClientAutoConfiguration().webClientBuilder(context.getBeanProvider(WebClientCustomizer.class)));
	context.registerBean(DefaultWebClientCodecCustomizer.class, () -> new DefaultWebClientCodecCustomizer(this.baseUrl, new ArrayList<>(context.getBeansOfType(CodecCustomizer.class).values())));
}
 
Example #3
Source File: TestWebClientBuilderConfiguration.java    From Hands-On-Reactive-Programming-in-Spring-5 with MIT License 4 votes vote down vote up
@Bean
public WebClientCustomizer testWebClientCustomizer(ExchangeFunction exchangeFunction) {
	return builder -> builder.exchangeFunction(exchangeFunction);
}
 
Example #4
Source File: ArmeriaClientAutoConfiguration.java    From armeria with Apache License 2.0 4 votes vote down vote up
/**
 * Returns a {@link WebClientCustomizer} which sets an {@link ArmeriaClientHttpConnector} to the
 * {@link Builder}.
 */
@Bean
public WebClientCustomizer webClientCustomizer(ClientHttpConnector clientHttpConnector) {
    return builder -> builder.clientConnector(clientHttpConnector);
}