Closed as not planned
Description
I followed the Spring Boot and Spring Framework documentations to configure a WebClient with Spring Boot 3.1.1.
I have
- configured the SSL following https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#io.rest-client.webclient.ssl
- configured timeouts following https://docs.spring.io/spring-framework/reference/web/webflux-webclient/client-builder.html#webflux-client-builder-reactor-timeout
These configurations are incompatible since they both set the ClientHttpConnector
on the WebClient.Builder
; the second configuration overrides the first one.
Here is a small application to reproduce:
@SpringBootApplication(proxyBeanMethods = false)
public class DemoApplication {
public static void main(String[] args) {
SpringApplication.run(DemoApplication.class, args);
}
@Bean
WebClient webClient(WebClient.Builder builder, WebClientSsl ssl) {
HttpClient httpClient = HttpClient.create()
.option(ChannelOption.CONNECT_TIMEOUT_MILLIS, 1);
return builder
.clientConnector(new ReactorClientHttpConnector(httpClient)) // TIMEOUT
.apply(ssl.fromBundle("demobundle")) // SSL
.build();
}
@Bean
ApplicationRunner runner(WebClient webClient) {
return new ApplicationRunner() {
@Override
public void run(ApplicationArguments args) throws Exception {
webClient.head()
.uri("https://www.google.com")
.exchangeToMono(r -> Mono.just(r.statusCode()))
.doOnSuccess(System.out::println)
.block();
}
};
}
}
with the following properties:
spring.ssl.bundle.pem.demobundle.key.password=password
spring.ssl.bundle.pem.demobundle.key.alias=alias
In that situation, a timeout does not occur but if I switch // TIMEOUT
with // SSL
lines, a timeout will occur but SSL is no more configured.
I didn't find a proper way to configure this without recreating the full SSL configuration in my application.