From b91bfc7067c60f05f30ebd1c6e84e8c21f5163ad Mon Sep 17 00:00:00 2001 From: rstoyanchev Date: Tue, 12 Apr 2022 10:31:06 +0100 Subject: [PATCH] Update WebMVC GraphQL autoconfig to the latest As a result of changes for https://github.com/spring-projects/spring-graphql/issues/342, GraphQlWebSocketHandler now exposes a method to create the WebSocketHttpRequestHandler, pre-configured with a context propagating HandshakeInterceptor. This commit updates the autoconfig to use it. Closes gh-30641 --- .../graphql/servlet/GraphQlWebMvcAutoConfiguration.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/graphql/servlet/GraphQlWebMvcAutoConfiguration.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/graphql/servlet/GraphQlWebMvcAutoConfiguration.java index 0c0ab9d1a9..8a9fd350b0 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/graphql/servlet/GraphQlWebMvcAutoConfiguration.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/graphql/servlet/GraphQlWebMvcAutoConfiguration.java @@ -69,7 +69,6 @@ import org.springframework.web.servlet.function.ServerResponse; import org.springframework.web.socket.WebSocketHandler; import org.springframework.web.socket.server.support.DefaultHandshakeHandler; import org.springframework.web.socket.server.support.WebSocketHandlerMapping; -import org.springframework.web.socket.server.support.WebSocketHttpRequestHandler; /** * {@link EnableAutoConfiguration Auto-configuration} for enabling Spring GraphQL over @@ -191,7 +190,7 @@ public class GraphQlWebMvcAutoConfiguration { WebSocketHandlerMapping mapping = new WebSocketHandlerMapping(); mapping.setWebSocketUpgradeMatch(true); mapping.setUrlMap(Collections.singletonMap(path, - new WebSocketHttpRequestHandler(handler, new DefaultHandshakeHandler()))); + handler.asWebSocketHttpRequestHandler(new DefaultHandshakeHandler()))); mapping.setOrder(2); // Ahead of HTTP endpoint ("routerFunctionMapping" bean) return mapping; }