Skip to content

Commit

Permalink
Update WebMVC GraphQL autoconfig to the latest
Browse files Browse the repository at this point in the history
As a result of changes for
spring-projects/spring-graphql#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
  • Loading branch information
rstoyanchev authored and bclozel committed Apr 12, 2022
1 parent 6580f6c commit b91bfc7
Showing 1 changed file with 1 addition and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@
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
Expand Down Expand Up @@ -191,7 +190,7 @@ public HandlerMapping graphQlWebSocketMapping(GraphQlWebSocketHandler handler, G
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;
}
Expand Down

0 comments on commit b91bfc7

Please sign in to comment.