diff --git a/spring-webflux/src/main/java/org/springframework/web/reactive/socket/server/support/HandshakeWebSocketService.java b/spring-webflux/src/main/java/org/springframework/web/reactive/socket/server/support/HandshakeWebSocketService.java index c9c39e3d0f6..a7ab423019a 100644 --- a/spring-webflux/src/main/java/org/springframework/web/reactive/socket/server/support/HandshakeWebSocketService.java +++ b/spring-webflux/src/main/java/org/springframework/web/reactive/socket/server/support/HandshakeWebSocketService.java @@ -62,14 +62,14 @@ public class HandshakeWebSocketService implements WebSocketService, Lifecycle { "org.eclipse.jetty.websocket.server.WebSocketServerFactory", HandshakeWebSocketService.class.getClassLoader()); - private static final boolean reactorNettyPresent = ClassUtils.isPresent( - "reactor.ipc.netty.http.server.HttpServerResponse", - HandshakeWebSocketService.class.getClassLoader()); - private static final boolean undertowPresent = ClassUtils.isPresent( "io.undertow.websockets.WebSocketProtocolHandshakeHandler", HandshakeWebSocketService.class.getClassLoader()); + private static final boolean reactorNettyPresent = ClassUtils.isPresent( + "reactor.ipc.netty.http.server.HttpServerResponse", + HandshakeWebSocketService.class.getClassLoader()); + protected static final Log logger = LogFactory.getLog(HandshakeWebSocketService.class); @@ -104,12 +104,13 @@ public class HandshakeWebSocketService implements WebSocketService, Lifecycle { else if (jettyPresent) { className = "JettyRequestUpgradeStrategy"; } - else if (reactorNettyPresent) { - className = "ReactorNettyRequestUpgradeStrategy"; - } else if (undertowPresent) { className = "UndertowRequestUpgradeStrategy"; } + else if (reactorNettyPresent) { + // As late as possible (Reactor Netty commonly used for WebClient) + className = "ReactorNettyRequestUpgradeStrategy"; + } else { throw new IllegalStateException("No suitable default RequestUpgradeStrategy found"); }