Polishing
This commit is contained in:
@@ -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<ServerResponse> graphQLQueryEndpoint(WebFluxGraphQLHandler handler) {
|
||||
return RouterFunctions.route().POST("/graphql", handler::handle).build();
|
||||
return RouterFunctions.route().POST("/graphql", handler).build();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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<ServerResponse> graphQLQueryEndpoint(WebMvcGraphQLHandler handler) {
|
||||
return RouterFunctions.route()
|
||||
.POST("/graphql", accept(MediaType.APPLICATION_JSON), handler::handle)
|
||||
.POST("/graphql", accept(MediaType.APPLICATION_JSON), handler)
|
||||
.build();
|
||||
}
|
||||
|
||||
|
||||
@@ -31,8 +31,8 @@ import org.springframework.web.reactive.function.server.ServerResponse;
|
||||
public class WebFluxGraphQLHandler extends WebHandlerSupport implements HandlerFunction<ServerResponse> {
|
||||
|
||||
|
||||
public WebFluxGraphQLHandler(GraphQL.Builder builder, List<WebInterceptor> interceptors) {
|
||||
super(builder, interceptors);
|
||||
public WebFluxGraphQLHandler(GraphQL graphQL, List<WebInterceptor> interceptors) {
|
||||
super(graphQL, interceptors);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -36,8 +36,8 @@ public abstract class WebHandlerSupport {
|
||||
private final List<WebInterceptor> interceptors;
|
||||
|
||||
|
||||
public WebHandlerSupport(GraphQL.Builder builder, List<WebInterceptor> interceptors) {
|
||||
this.graphQL = builder.build();
|
||||
public WebHandlerSupport(GraphQL graphQL, List<WebInterceptor> interceptors) {
|
||||
this.graphQL = graphQL;
|
||||
this.interceptors = (!CollectionUtils.isEmpty(interceptors) ?
|
||||
Collections.unmodifiableList(new ArrayList<>(interceptors)) : Collections.emptyList());
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -38,8 +38,8 @@ import org.springframework.web.servlet.function.ServerResponse;
|
||||
public class WebMvcGraphQLHandler extends WebHandlerSupport implements HandlerFunction<ServerResponse> {
|
||||
|
||||
|
||||
public WebMvcGraphQLHandler(GraphQL.Builder builder, List<WebInterceptor> interceptors) {
|
||||
super(builder, interceptors);
|
||||
public WebMvcGraphQLHandler(GraphQL graphQL, List<WebInterceptor> interceptors) {
|
||||
super(graphQL, interceptors);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user