Skip to content

Commit 3635ff0

Browse files
committed
Consistent fallback to NoUpgradeStrategyWebSocketService
Closes gh-33970 (cherry picked from commit 58c64cb)
1 parent f20e76e commit 3635ff0

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

spring-webflux/src/main/java/org/springframework/web/reactive/config/WebFluxConfigurationSupport.java

+9-3
Original file line numberDiff line numberDiff line change
@@ -478,9 +478,9 @@ private WebSocketService initWebSocketService() {
478478
try {
479479
service = new HandshakeWebSocketService();
480480
}
481-
catch (IllegalStateException ex) {
481+
catch (Throwable ex) {
482482
// Don't fail, test environment perhaps
483-
service = new NoUpgradeStrategyWebSocketService();
483+
service = new NoUpgradeStrategyWebSocketService(ex);
484484
}
485485
}
486486
return service;
@@ -578,9 +578,15 @@ public void validate(@Nullable Object target, Errors errors) {
578578

579579
private static final class NoUpgradeStrategyWebSocketService implements WebSocketService {
580580

581+
private final Throwable ex;
582+
583+
public NoUpgradeStrategyWebSocketService(Throwable ex) {
584+
this.ex = ex;
585+
}
586+
581587
@Override
582588
public Mono<Void> handleRequest(ServerWebExchange exchange, WebSocketHandler webSocketHandler) {
583-
return Mono.error(new IllegalStateException("No suitable RequestUpgradeStrategy"));
589+
return Mono.error(new IllegalStateException("No suitable RequestUpgradeStrategy", this.ex));
584590
}
585591
}
586592

0 commit comments

Comments
 (0)