I\'m trying to set timeout on my WebClient, here is the current code :
SslContext sslContext = SslContextBuilder.forClient().trustManager(InsecureTrustManag
As Spring Webflux was updated, here is a solution that works for Java (based on the answer for Kotlin):
TcpClient timeoutClient = TcpClient.create()
.option(ChannelOption.CONNECT_TIMEOUT_MILLIS, SECONDS*1000)
.doOnConnected(
c -> c.addHandlerLast(new ReadTimeoutHandler(SECONDS))
.addHandlerLast(new WriteTimeoutHandler(SECONDS)));
return webClientBuilder.baseUrl(YOUR_URL)
.clientConnector(new ReactorClientHttpConnector(HttpClient.from(timeoutClient)))
.build();