SpringBoot Version: 2.3.11.RELEASE
We use a shaded version of reactor-netty, by default, for our internal WebClient extensions and intentionally, for springboot 2.3.x do not include reactor-netty due to a variety of versions, conflicts, contention over this library across hundreds of projects.
Recently, app owners who use SpringBootTest for web environment RANDOM_PORT and who transitively brought in WebClient extensions - spring-webflux only - encounter:
java.lang.NoClassDefFoundError: reactor/netty/http/client/HttpClient
We expose the WebClient interface from spring-webflux only. However WebTestClientContextCustomizerFactory::isWebClientPresent() is the only check guarding the use of the reactor-netty based connector employed vis-a-vis WebTestClientContextCustomizer, leading to the chain:
WebTestClientContextCustomizer.WebTestClientFactory::createWebTestClient()
WebTestClient.bindToServer()
new DefaultWebTestClientBuilder()
new ReactorClientHttpConnector()
The last, of course fails - there is no reactor-netty and it was never checked. The last portion of this chain passes through a static WebTestClient.bindToServer and non public classes that cannot be overridden. I don't think its safe to assume that if one is using the WebClient API that its automatically means they are also using reactor-netty, etc, etc. I believe there should be additional checks here, at a minimum. (cc @smaldini )