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
pull/29812/head
rstoyanchev 3 years ago committed by Brian Clozel
parent 6580f6c742
commit b91bfc7067

@ -69,7 +69,6 @@ import org.springframework.web.servlet.function.ServerResponse;
import org.springframework.web.socket.WebSocketHandler; import org.springframework.web.socket.WebSocketHandler;
import org.springframework.web.socket.server.support.DefaultHandshakeHandler; import org.springframework.web.socket.server.support.DefaultHandshakeHandler;
import org.springframework.web.socket.server.support.WebSocketHandlerMapping; 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 * {@link EnableAutoConfiguration Auto-configuration} for enabling Spring GraphQL over
@ -191,7 +190,7 @@ public class GraphQlWebMvcAutoConfiguration {
WebSocketHandlerMapping mapping = new WebSocketHandlerMapping(); WebSocketHandlerMapping mapping = new WebSocketHandlerMapping();
mapping.setWebSocketUpgradeMatch(true); mapping.setWebSocketUpgradeMatch(true);
mapping.setUrlMap(Collections.singletonMap(path, mapping.setUrlMap(Collections.singletonMap(path,
new WebSocketHttpRequestHandler(handler, new DefaultHandshakeHandler()))); handler.asWebSocketHttpRequestHandler(new DefaultHandshakeHandler())));
mapping.setOrder(2); // Ahead of HTTP endpoint ("routerFunctionMapping" bean) mapping.setOrder(2); // Ahead of HTTP endpoint ("routerFunctionMapping" bean)
return mapping; return mapping;
} }

Loading…
Cancel
Save