From 40a79ab71a1c0d00b5bef70ac1d017ea3b9183de Mon Sep 17 00:00:00 2001 From: Rossen Stoyanchev Date: Fri, 18 Sep 2020 17:44:21 +0100 Subject: [PATCH] Polishing --- .../boot/graphql/WebFluxGraphQLAutoConfiguration.java | 4 ++-- .../boot/graphql/WebMvcGraphQLAutoConfiguration.java | 4 ++-- .../org/springframework/graphql/WebFluxGraphQLHandler.java | 4 ++-- .../java/org/springframework/graphql/WebHandlerSupport.java | 4 ++-- .../src/main/java/org/springframework/graphql/WebInput.java | 2 -- .../org/springframework/graphql/WebMvcGraphQLHandler.java | 4 ++-- 6 files changed, 10 insertions(+), 12 deletions(-) diff --git a/spring-graphql-web/src/main/java/org/springframework/boot/graphql/WebFluxGraphQLAutoConfiguration.java b/spring-graphql-web/src/main/java/org/springframework/boot/graphql/WebFluxGraphQLAutoConfiguration.java index 89a5a445..b48ad819 100644 --- a/spring-graphql-web/src/main/java/org/springframework/boot/graphql/WebFluxGraphQLAutoConfiguration.java +++ b/spring-graphql-web/src/main/java/org/springframework/boot/graphql/WebFluxGraphQLAutoConfiguration.java @@ -41,12 +41,12 @@ public class WebFluxGraphQLAutoConfiguration { @Bean @ConditionalOnMissingBean public WebFluxGraphQLHandler graphQLHandler(GraphQL.Builder graphQLBuilder) { - return new WebFluxGraphQLHandler(graphQLBuilder, Collections.emptyList()); + return new WebFluxGraphQLHandler(graphQLBuilder.build(), Collections.emptyList()); } @Bean public RouterFunction graphQLQueryEndpoint(WebFluxGraphQLHandler handler) { - return RouterFunctions.route().POST("/graphql", handler::handle).build(); + return RouterFunctions.route().POST("/graphql", handler).build(); } } diff --git a/spring-graphql-web/src/main/java/org/springframework/boot/graphql/WebMvcGraphQLAutoConfiguration.java b/spring-graphql-web/src/main/java/org/springframework/boot/graphql/WebMvcGraphQLAutoConfiguration.java index 674ffd8c..7f5f7c91 100644 --- a/spring-graphql-web/src/main/java/org/springframework/boot/graphql/WebMvcGraphQLAutoConfiguration.java +++ b/spring-graphql-web/src/main/java/org/springframework/boot/graphql/WebMvcGraphQLAutoConfiguration.java @@ -44,13 +44,13 @@ public class WebMvcGraphQLAutoConfiguration { @Bean @ConditionalOnMissingBean public WebMvcGraphQLHandler graphQLHandler(GraphQL.Builder graphQLBuilder) { - return new WebMvcGraphQLHandler(graphQLBuilder, Collections.emptyList()); + return new WebMvcGraphQLHandler(graphQLBuilder.build(), Collections.emptyList()); } @Bean public RouterFunction graphQLQueryEndpoint(WebMvcGraphQLHandler handler) { return RouterFunctions.route() - .POST("/graphql", accept(MediaType.APPLICATION_JSON), handler::handle) + .POST("/graphql", accept(MediaType.APPLICATION_JSON), handler) .build(); } diff --git a/spring-graphql-web/src/main/java/org/springframework/graphql/WebFluxGraphQLHandler.java b/spring-graphql-web/src/main/java/org/springframework/graphql/WebFluxGraphQLHandler.java index 11b60206..16925ff6 100644 --- a/spring-graphql-web/src/main/java/org/springframework/graphql/WebFluxGraphQLHandler.java +++ b/spring-graphql-web/src/main/java/org/springframework/graphql/WebFluxGraphQLHandler.java @@ -31,8 +31,8 @@ import org.springframework.web.reactive.function.server.ServerResponse; public class WebFluxGraphQLHandler extends WebHandlerSupport implements HandlerFunction { - public WebFluxGraphQLHandler(GraphQL.Builder builder, List interceptors) { - super(builder, interceptors); + public WebFluxGraphQLHandler(GraphQL graphQL, List interceptors) { + super(graphQL, interceptors); } diff --git a/spring-graphql-web/src/main/java/org/springframework/graphql/WebHandlerSupport.java b/spring-graphql-web/src/main/java/org/springframework/graphql/WebHandlerSupport.java index 45147f64..22a0d3fa 100644 --- a/spring-graphql-web/src/main/java/org/springframework/graphql/WebHandlerSupport.java +++ b/spring-graphql-web/src/main/java/org/springframework/graphql/WebHandlerSupport.java @@ -36,8 +36,8 @@ public abstract class WebHandlerSupport { private final List interceptors; - public WebHandlerSupport(GraphQL.Builder builder, List interceptors) { - this.graphQL = builder.build(); + public WebHandlerSupport(GraphQL graphQL, List interceptors) { + this.graphQL = graphQL; this.interceptors = (!CollectionUtils.isEmpty(interceptors) ? Collections.unmodifiableList(new ArrayList<>(interceptors)) : Collections.emptyList()); } diff --git a/spring-graphql-web/src/main/java/org/springframework/graphql/WebInput.java b/spring-graphql-web/src/main/java/org/springframework/graphql/WebInput.java index f6a70f5d..be22fcd4 100644 --- a/spring-graphql-web/src/main/java/org/springframework/graphql/WebInput.java +++ b/spring-graphql-web/src/main/java/org/springframework/graphql/WebInput.java @@ -17,11 +17,9 @@ package org.springframework.graphql; import java.net.URI; import java.util.Collections; -import java.util.List; import java.util.Map; import graphql.ExecutionInput; -import reactor.core.publisher.Mono; import org.springframework.core.ParameterizedTypeReference; import org.springframework.http.HttpHeaders; diff --git a/spring-graphql-web/src/main/java/org/springframework/graphql/WebMvcGraphQLHandler.java b/spring-graphql-web/src/main/java/org/springframework/graphql/WebMvcGraphQLHandler.java index 5acddbb3..85ddbe7b 100644 --- a/spring-graphql-web/src/main/java/org/springframework/graphql/WebMvcGraphQLHandler.java +++ b/spring-graphql-web/src/main/java/org/springframework/graphql/WebMvcGraphQLHandler.java @@ -38,8 +38,8 @@ import org.springframework.web.servlet.function.ServerResponse; public class WebMvcGraphQLHandler extends WebHandlerSupport implements HandlerFunction { - public WebMvcGraphQLHandler(GraphQL.Builder builder, List interceptors) { - super(builder, interceptors); + public WebMvcGraphQLHandler(GraphQL graphQL, List interceptors) { + super(graphQL, interceptors); }