HttpClient.create().tcpConfiguration deprecated in Spring boot 3

181 Views Asked by At

I want to migrate Spring boot 2 to Spring boot 3 and i saw that httpClient.create.tcpConfiguration is deprecated.

How can i rewrite this code

HttpClient httpcl = HttpClient.create().tcpConfiguration(client -> client.option(ChannelOption.CONNECT_TIMEOUT_MILLIS, connectionTimeOut).doOnConnected(
conn -> conn.addHandlerLast(new ReadTimeoutHandler(readTimeOut)).addHandlerLast(new WriteTimeoutHandler(writeTimeOut)))).wiretap(enableWireTap).compress(true);
1

There are 1 best solutions below

0
On

You can add those configurations directly on the level of HttpClient

        HttpClient httpcl = HttpClient.create()
            .option(ChannelOption.CONNECT_TIMEOUT_MILLIS, connectionTimeOut)
            .doOnConnected(conn -> conn.addHandlerLast(new ReadTimeoutHandler(readTimeOut))
                    .addHandlerLast(new WriteTimeoutHandler(writeTimeOut)))
            .wiretap(enableWireTap)
            .compress(true);

More examples you can find in the javadoc