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

The following examples show how to use org.springframework.boot.web.reactive.function.client.WebClientCustomizer. These examples are extracted from open source projects. 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 Project: spring-cloud-sleuth   Source File: WebClientBraveTests.java    License: 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
@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
@Bean
public WebClientCustomizer testWebClientCustomizer(ExchangeFunction exchangeFunction) {
	return builder -> builder.exchangeFunction(exchangeFunction);
}
 
Example 4
Source Project: armeria   Source File: ArmeriaClientAutoConfiguration.java    License: 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);
}