📝 Proposal: Add QUIC (HTTP/3) Support to Spring WebClient
🎯 Motivation
QUIC is the transport protocol behind HTTP/3, offering:
Faster connection setup (0-RTT)
Stream multiplexing without head-of-line blocking
Built-in TLS 1.3 encryption
Better performance on mobile and lossy networks
Spring WebClient currently supports HTTP/1.1 and HTTP/2 via Reactor Netty. Adding QUIC support would future-proof the framework and enable high-performance reactive clients for modern web services.
🔧 Technical Approach
1. Choose a QUIC Implementation
Use Kwik, a 100% Java QUIC library that supports both client and server roles. It’s actively maintained and interoperable with other QUIC stacks.
2. Create a Custom ClientHttpConnector
Spring WebClient uses ClientHttpConnector to abstract the transport. You can implement a new connector:
public class QuicHttpConnector implements ClientHttpConnector {
// Wrap Kwik's QuicClientConnection and QuicStream
}
3. Handle HTTP/3 Semantics
Use Kwik’s Flupke plugin to support HTTP/3 on top of QUIC. This handles:
Stream negotiation
Request/response framing
ALPN protocol selection
4. Integrate with Reactor
Ensure the connector supports non-blocking I/O and reactive streams:
Wrap Kwik’s input/output streams in Flux
Use DataBufferFactory for efficient memory handling
5. Configuration Options
Expose QUIC-specific settings:
ALPN protocol ID
0-RTT support
Cipher suite selection
Certificate validation toggle
🧪 Testing Strategy
Use public QUIC endpoints (e.g., Cloudflare, Google) for integration tests
Benchmark against HTTP/2 for latency and throughput
Simulate packet loss and connection migration scenarios
📚 Documentation & Samples
Provide usage examples:
WebClient client = WebClient.builder()
.clientConnector(new QuicHttpConnector())
.build();
Document limitations (e.g., stream prioritization not yet supported)