mirror of
https://github.com/spring-projects/spring-boot.git
synced 2026-09-17 12:09:16 +00:00
Switch to Spring for GraphQL 2.1.0-SNAPSHOT
See gh-51713
This commit is contained in:
+10
-13
@@ -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
|
||||
|
||||
+11
-13
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user