diff --git a/module/spring-boot-graphql/src/main/java/org/springframework/boot/graphql/autoconfigure/reactive/GraphQlWebFluxAutoConfiguration.java b/module/spring-boot-graphql/src/main/java/org/springframework/boot/graphql/autoconfigure/reactive/GraphQlWebFluxAutoConfiguration.java index f3fd9062378..f29a34e64f1 100644 --- a/module/spring-boot-graphql/src/main/java/org/springframework/boot/graphql/autoconfigure/reactive/GraphQlWebFluxAutoConfiguration.java +++ b/module/spring-boot-graphql/src/main/java/org/springframework/boot/graphql/autoconfigure/reactive/GraphQlWebFluxAutoConfiguration.java @@ -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 diff --git a/module/spring-boot-graphql/src/main/java/org/springframework/boot/graphql/autoconfigure/servlet/GraphQlWebMvcAutoConfiguration.java b/module/spring-boot-graphql/src/main/java/org/springframework/boot/graphql/autoconfigure/servlet/GraphQlWebMvcAutoConfiguration.java index a8fad3d1e50..97cbe30a119 100644 --- a/module/spring-boot-graphql/src/main/java/org/springframework/boot/graphql/autoconfigure/servlet/GraphQlWebMvcAutoConfiguration.java +++ b/module/spring-boot-graphql/src/main/java/org/springframework/boot/graphql/autoconfigure/servlet/GraphQlWebMvcAutoConfiguration.java @@ -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 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 getJsonConverter( diff --git a/platform/spring-boot-dependencies/build.gradle b/platform/spring-boot-dependencies/build.gradle index 6cf7abbcc5e..c40f879d776 100644 --- a/platform/spring-boot-dependencies/build.gradle +++ b/platform/spring-boot-dependencies/build.gradle @@ -2776,7 +2776,7 @@ bom { releaseNotes("https://github.com/spring-projects/spring-framework/releases/tag/v{version}") } } - library("Spring GraphQL", "2.0.5") { + library("Spring GraphQL", "2.1.0-SNAPSHOT") { firstParty() group("org.springframework.graphql") { modules = [