Switch to Spring for GraphQL 2.1.0-SNAPSHOT

See gh-51713
This commit is contained in:
Brian Clozel
2026-09-14 12:00:40 +02:00
parent 4bc86fedc4
commit 8798aa6350
3 changed files with 22 additions and 27 deletions
@@ -91,14 +91,16 @@ public final class GraphQlWebFluxAutoConfiguration {
@Bean
@ConditionalOnMissingBean
GraphQlHttpHandler graphQlHttpHandler(WebGraphQlHandler webGraphQlHandler) {
return new GraphQlHttpHandler(webGraphQlHandler);
return GraphQlHttpHandler.builder(webGraphQlHandler).build();
}
@Bean
@ConditionalOnMissingBean
GraphQlSseHandler graphQlSseHandler(WebGraphQlHandler webGraphQlHandler, GraphQlProperties properties) {
return new GraphQlSseHandler(webGraphQlHandler, properties.getHttp().getSse().getTimeout(),
properties.getHttp().getSse().getKeepAlive());
return GraphQlSseHandler.builder(webGraphQlHandler)
.timeout(properties.getHttp().getSse().getTimeout())
.keepAliveDuration(properties.getHttp().getSse().getKeepAlive())
.build();
}
@Bean
@@ -181,16 +183,11 @@ public final class GraphQlWebFluxAutoConfiguration {
@ConditionalOnMissingBean
GraphQlWebSocketHandler graphQlWebSocketHandler(WebGraphQlHandler webGraphQlHandler,
GraphQlProperties properties, GraphQlCorsProperties corsProperties, ServerCodecConfigurer configurer) {
CorsConfiguration corsConfiguration = corsProperties.toCorsConfiguration();
if (corsConfiguration != null) {
return new GraphQlWebSocketHandler(webGraphQlHandler, configurer,
properties.getWebsocket().getConnectionInitTimeout(), properties.getWebsocket().getKeepAlive(),
corsConfiguration);
}
else {
return new GraphQlWebSocketHandler(webGraphQlHandler, configurer,
properties.getWebsocket().getConnectionInitTimeout(), properties.getWebsocket().getKeepAlive());
}
return GraphQlWebSocketHandler
.builder(webGraphQlHandler, configurer, properties.getWebsocket().getConnectionInitTimeout())
.keepAliveDuration(properties.getWebsocket().getKeepAlive())
.corsConfiguration(corsProperties.toCorsConfiguration())
.build();
}
@Bean
@@ -96,14 +96,16 @@ public final class GraphQlWebMvcAutoConfiguration {
@Bean
@ConditionalOnMissingBean
GraphQlHttpHandler graphQlHttpHandler(WebGraphQlHandler webGraphQlHandler) {
return new GraphQlHttpHandler(webGraphQlHandler);
return GraphQlHttpHandler.builder(webGraphQlHandler).build();
}
@Bean
@ConditionalOnMissingBean
GraphQlSseHandler graphQlSseHandler(WebGraphQlHandler webGraphQlHandler, GraphQlProperties properties) {
return new GraphQlSseHandler(webGraphQlHandler, properties.getHttp().getSse().getTimeout(),
properties.getHttp().getSse().getKeepAlive());
return GraphQlSseHandler.builder(webGraphQlHandler)
.timeout(properties.getHttp().getSse().getTimeout())
.keepAliveDuration(properties.getHttp().getSse().getKeepAlive())
.build();
}
@Bean
@@ -188,16 +190,12 @@ public final class GraphQlWebMvcAutoConfiguration {
GraphQlWebSocketHandler graphQlWebSocketHandler(WebGraphQlHandler webGraphQlHandler,
GraphQlProperties properties, GraphQlCorsProperties corsProperties,
ObjectProvider<ServerHttpMessageConvertersCustomizer> customizers) {
CorsConfiguration corsConfiguration = corsProperties.toCorsConfiguration();
if (corsConfiguration != null) {
return new GraphQlWebSocketHandler(webGraphQlHandler, getJsonConverter(customizers),
properties.getWebsocket().getConnectionInitTimeout(), properties.getWebsocket().getKeepAlive(),
corsConfiguration);
}
else {
return new GraphQlWebSocketHandler(webGraphQlHandler, getJsonConverter(customizers),
properties.getWebsocket().getConnectionInitTimeout(), properties.getWebsocket().getKeepAlive());
}
return GraphQlWebSocketHandler
.builder(webGraphQlHandler, getJsonConverter(customizers),
properties.getWebsocket().getConnectionInitTimeout())
.keepAliveDuration(properties.getWebsocket().getKeepAlive())
.corsConfiguration(corsProperties.toCorsConfiguration())
.build();
}
private HttpMessageConverter<Object> getJsonConverter(