Switch to Spring for GraphQL 1.0.0-SNAPSHOT

See gh-30463
pull/30472/head
Brian Clozel 3 years ago
parent 4466a0b041
commit 93817c708e

@ -41,12 +41,12 @@ import org.springframework.context.annotation.Configuration;
import org.springframework.core.log.LogMessage; import org.springframework.core.log.LogMessage;
import org.springframework.graphql.ExecutionGraphQlService; import org.springframework.graphql.ExecutionGraphQlService;
import org.springframework.graphql.execution.GraphQlSource; import org.springframework.graphql.execution.GraphQlSource;
import org.springframework.graphql.web.WebGraphQlHandler; import org.springframework.graphql.server.WebGraphQlHandler;
import org.springframework.graphql.web.WebGraphQlHandlerInterceptor; import org.springframework.graphql.server.WebGraphQlInterceptor;
import org.springframework.graphql.web.webflux.GraphQlHttpHandler; import org.springframework.graphql.server.webflux.GraphQlHttpHandler;
import org.springframework.graphql.web.webflux.GraphQlWebSocketHandler; import org.springframework.graphql.server.webflux.GraphQlWebSocketHandler;
import org.springframework.graphql.web.webflux.GraphiQlHandler; import org.springframework.graphql.server.webflux.GraphiQlHandler;
import org.springframework.graphql.web.webflux.SchemaHandler; import org.springframework.graphql.server.webflux.SchemaHandler;
import org.springframework.http.HttpHeaders; import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod; import org.springframework.http.HttpMethod;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
@ -95,7 +95,7 @@ public class GraphQlWebFluxAutoConfiguration {
@Bean @Bean
@ConditionalOnMissingBean @ConditionalOnMissingBean
public WebGraphQlHandler webGraphQlHandler(ExecutionGraphQlService service, public WebGraphQlHandler webGraphQlHandler(ExecutionGraphQlService service,
ObjectProvider<WebGraphQlHandlerInterceptor> interceptorsProvider) { ObjectProvider<WebGraphQlInterceptor> interceptorsProvider) {
return WebGraphQlHandler.builder(service) return WebGraphQlHandler.builder(service)
.interceptors(interceptorsProvider.orderedStream().collect(Collectors.toList())).build(); .interceptors(interceptorsProvider.orderedStream().collect(Collectors.toList())).build();
} }

@ -27,7 +27,7 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplicat
import org.springframework.boot.autoconfigure.graphql.reactive.GraphQlWebFluxAutoConfiguration; import org.springframework.boot.autoconfigure.graphql.reactive.GraphQlWebFluxAutoConfiguration;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.graphql.execution.ReactiveSecurityDataFetcherExceptionResolver; import org.springframework.graphql.execution.ReactiveSecurityDataFetcherExceptionResolver;
import org.springframework.graphql.web.webflux.GraphQlHttpHandler; import org.springframework.graphql.server.webflux.GraphQlHttpHandler;
import org.springframework.security.config.annotation.web.reactive.EnableWebFluxSecurity; import org.springframework.security.config.annotation.web.reactive.EnableWebFluxSecurity;
/** /**

@ -28,7 +28,7 @@ import org.springframework.boot.autoconfigure.graphql.servlet.GraphQlWebMvcAutoC
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.graphql.execution.SecurityContextThreadLocalAccessor; import org.springframework.graphql.execution.SecurityContextThreadLocalAccessor;
import org.springframework.graphql.execution.SecurityDataFetcherExceptionResolver; import org.springframework.graphql.execution.SecurityDataFetcherExceptionResolver;
import org.springframework.graphql.web.webmvc.GraphQlHttpHandler; import org.springframework.graphql.server.webmvc.GraphQlHttpHandler;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
/** /**

@ -45,12 +45,12 @@ import org.springframework.core.log.LogMessage;
import org.springframework.graphql.ExecutionGraphQlService; import org.springframework.graphql.ExecutionGraphQlService;
import org.springframework.graphql.execution.GraphQlSource; import org.springframework.graphql.execution.GraphQlSource;
import org.springframework.graphql.execution.ThreadLocalAccessor; import org.springframework.graphql.execution.ThreadLocalAccessor;
import org.springframework.graphql.web.WebGraphQlHandler; import org.springframework.graphql.server.WebGraphQlHandler;
import org.springframework.graphql.web.WebGraphQlHandlerInterceptor; import org.springframework.graphql.server.WebGraphQlInterceptor;
import org.springframework.graphql.web.webmvc.GraphQlHttpHandler; import org.springframework.graphql.server.webmvc.GraphQlHttpHandler;
import org.springframework.graphql.web.webmvc.GraphQlWebSocketHandler; import org.springframework.graphql.server.webmvc.GraphQlWebSocketHandler;
import org.springframework.graphql.web.webmvc.GraphiQlHandler; import org.springframework.graphql.server.webmvc.GraphiQlHandler;
import org.springframework.graphql.web.webmvc.SchemaHandler; import org.springframework.graphql.server.webmvc.SchemaHandler;
import org.springframework.http.HttpHeaders; import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod; import org.springframework.http.HttpMethod;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
@ -87,6 +87,9 @@ public class GraphQlWebMvcAutoConfiguration {
private static final Log logger = LogFactory.getLog(GraphQlWebMvcAutoConfiguration.class); private static final Log logger = LogFactory.getLog(GraphQlWebMvcAutoConfiguration.class);
private static MediaType[] SUPPORTED_MEDIA_TYPES = new MediaType[] { MediaType.valueOf("application/graphql+json"),
MediaType.APPLICATION_JSON };
@Bean @Bean
@ConditionalOnMissingBean @ConditionalOnMissingBean
public GraphQlHttpHandler graphQlHttpHandler(WebGraphQlHandler webGraphQlHandler) { public GraphQlHttpHandler graphQlHttpHandler(WebGraphQlHandler webGraphQlHandler) {
@ -96,7 +99,7 @@ public class GraphQlWebMvcAutoConfiguration {
@Bean @Bean
@ConditionalOnMissingBean @ConditionalOnMissingBean
public WebGraphQlHandler webGraphQlHandler(ExecutionGraphQlService service, public WebGraphQlHandler webGraphQlHandler(ExecutionGraphQlService service,
ObjectProvider<WebGraphQlHandlerInterceptor> interceptorsProvider, ObjectProvider<WebGraphQlInterceptor> interceptorsProvider,
ObjectProvider<ThreadLocalAccessor> accessorsProvider) { ObjectProvider<ThreadLocalAccessor> accessorsProvider) {
return WebGraphQlHandler.builder(service) return WebGraphQlHandler.builder(service)
.interceptors(interceptorsProvider.orderedStream().collect(Collectors.toList())) .interceptors(interceptorsProvider.orderedStream().collect(Collectors.toList()))

@ -33,10 +33,10 @@ import org.springframework.boot.test.context.runner.ReactiveWebApplicationContex
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.graphql.execution.RuntimeWiringConfigurer; import org.springframework.graphql.execution.RuntimeWiringConfigurer;
import org.springframework.graphql.web.WebGraphQlHandler; import org.springframework.graphql.server.WebGraphQlHandler;
import org.springframework.graphql.web.WebGraphQlHandlerInterceptor; import org.springframework.graphql.server.WebGraphQlInterceptor;
import org.springframework.graphql.web.webflux.GraphQlHttpHandler; import org.springframework.graphql.server.webflux.GraphQlHttpHandler;
import org.springframework.graphql.web.webflux.GraphQlWebSocketHandler; import org.springframework.graphql.server.webflux.GraphQlWebSocketHandler;
import org.springframework.http.HttpHeaders; import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType; import org.springframework.http.MediaType;
@ -172,7 +172,7 @@ class GraphQlWebFluxAutoConfigurationTests {
static class CustomWebInterceptor { static class CustomWebInterceptor {
@Bean @Bean
WebGraphQlHandlerInterceptor customWebGraphQlHandlerInterceptor() { WebGraphQlInterceptor customWebGraphQlInterceptor() {
return (webInput, interceptorChain) -> interceptorChain.next(webInput) return (webInput, interceptorChain) -> interceptorChain.next(webInput)
.doOnNext((output) -> output.getResponseHeaders().add("X-Custom-Header", "42")); .doOnNext((output) -> output.getResponseHeaders().add("X-Custom-Header", "42"));
} }

@ -31,10 +31,10 @@ import org.springframework.boot.test.context.runner.WebApplicationContextRunner;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.graphql.execution.RuntimeWiringConfigurer; import org.springframework.graphql.execution.RuntimeWiringConfigurer;
import org.springframework.graphql.web.WebGraphQlHandler; import org.springframework.graphql.server.WebGraphQlHandler;
import org.springframework.graphql.web.WebGraphQlHandlerInterceptor; import org.springframework.graphql.server.WebGraphQlInterceptor;
import org.springframework.graphql.web.webmvc.GraphQlHttpHandler; import org.springframework.graphql.server.webmvc.GraphQlHttpHandler;
import org.springframework.graphql.web.webmvc.GraphQlWebSocketHandler; import org.springframework.graphql.server.webmvc.GraphQlWebSocketHandler;
import org.springframework.http.HttpHeaders; import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType; import org.springframework.http.MediaType;
import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.MockMvc;
@ -183,7 +183,7 @@ class GraphQlWebMvcAutoConfigurationTests {
static class CustomWebInterceptor { static class CustomWebInterceptor {
@Bean @Bean
WebGraphQlHandlerInterceptor customWebGraphQlHandlerInterceptor() { WebGraphQlInterceptor customWebGraphQlInterceptor() {
return (webInput, interceptorChain) -> interceptorChain.next(webInput) return (webInput, interceptorChain) -> interceptorChain.next(webInput)
.doOnNext((output) -> output.getResponseHeaders().add("X-Custom-Header", "42")); .doOnNext((output) -> output.getResponseHeaders().add("X-Custom-Header", "42"));
} }

@ -1715,7 +1715,7 @@ bom {
] ]
} }
} }
library("Spring GraphQL", "1.0.0-M6") { library("Spring GraphQL", "1.0.0-SNAPSHOT") {
group("org.springframework.graphql") { group("org.springframework.graphql") {
modules = [ modules = [
"spring-graphql", "spring-graphql",

@ -47,9 +47,9 @@ import org.springframework.core.type.classreading.SimpleMetadataReaderFactory;
import org.springframework.graphql.execution.DataFetcherExceptionResolver; import org.springframework.graphql.execution.DataFetcherExceptionResolver;
import org.springframework.graphql.execution.GraphQlSource.Builder; import org.springframework.graphql.execution.GraphQlSource.Builder;
import org.springframework.graphql.execution.RuntimeWiringConfigurer; import org.springframework.graphql.execution.RuntimeWiringConfigurer;
import org.springframework.graphql.web.WebGraphQlHandlerInterceptor; import org.springframework.graphql.server.WebGraphQlInterceptor;
import org.springframework.graphql.web.WebGraphQlRequest; import org.springframework.graphql.server.WebGraphQlRequest;
import org.springframework.graphql.web.WebGraphQlResponse; import org.springframework.graphql.server.WebGraphQlResponse;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -199,7 +199,7 @@ class GraphQlTypeExcludeFilterTests {
} }
static class ExampleWebInterceptor implements WebGraphQlHandlerInterceptor { static class ExampleWebInterceptor implements WebGraphQlInterceptor {
@Override @Override
public Mono<WebGraphQlResponse> intercept(WebGraphQlRequest request, Chain chain) { public Mono<WebGraphQlResponse> intercept(WebGraphQlRequest request, Chain chain) {

Loading…
Cancel
Save