在Reactor-netty
0.9.0.M4版本之前,默认情况下没有限制,因为使用了“弹性”连接提供程序。此修复程序将其更改为“固定的”连接提供程序,限制为500。
要更改连接池限制,您可以定义自己的
WebClient.Builderbean并使用它来创建
WebClient
@Beanpublic WebClient.Builder webClientBuilder() { String connectionProviderName = "myConnectionProvider"; int maxConnections = 100; int acquireTimeout = 1000; HttpClient httpClient = HttpClient.create(ConnectionProvider .fixed(connectionProviderName, maxConnections, acquireTimeout)); return WebClient.builder() .clientConnector(new ReactorClientHttpConnector(httpClient));}或者您可以
org.springframework.boot.web.reactive.function.client.WebClientCustomizer使用预定义的方式以相同的方式实现自定义
WebClient.Builder



