Polishing contribution
Closes gh-37
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2020-2020 the original author or authors.
|
||||
* Copyright 2020-2021 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -43,9 +43,21 @@ import org.springframework.core.io.ResourceLoader;
|
||||
@EnableConfigurationProperties(GraphQLProperties.class)
|
||||
public class GraphQLAutoConfiguration {
|
||||
|
||||
|
||||
@Configuration
|
||||
static class GraphQLConfiguration {
|
||||
|
||||
@Bean
|
||||
public GraphQL graphQL(GraphQL.Builder builder) {
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Configuration
|
||||
@ConditionalOnMissingBean(GraphQL.Builder.class)
|
||||
static class SdlConfiguration {
|
||||
static class GraphQLBuilderConfiguration {
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
|
||||
@@ -52,17 +52,12 @@ import static org.springframework.web.reactive.function.server.RequestPredicates
|
||||
@Configuration
|
||||
@ConditionalOnWebApplication(type = ConditionalOnWebApplication.Type.REACTIVE)
|
||||
@ConditionalOnClass(GraphQL.class)
|
||||
@ConditionalOnBean(GraphQL.Builder.class)
|
||||
@ConditionalOnBean(GraphQL.class)
|
||||
@AutoConfigureAfter(GraphQLAutoConfiguration.class)
|
||||
public class WebFluxGraphQLAutoConfiguration {
|
||||
|
||||
private static final Log logger = LogFactory.getLog(WebFluxGraphQLAutoConfiguration.class);
|
||||
|
||||
@Bean
|
||||
public GraphQL graphQL(GraphQL.Builder graphQLBuilder) {
|
||||
return graphQLBuilder.build();
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
public GraphQLHttpHandler graphQLHandler(GraphQL graphQL, ObjectProvider<WebInterceptor> interceptors) {
|
||||
|
||||
@@ -59,21 +59,15 @@ import static org.springframework.web.servlet.function.RequestPredicates.content
|
||||
@Configuration
|
||||
@ConditionalOnWebApplication(type = ConditionalOnWebApplication.Type.SERVLET)
|
||||
@ConditionalOnClass(GraphQL.class)
|
||||
@ConditionalOnBean(GraphQL.Builder.class)
|
||||
@ConditionalOnBean(GraphQL.class)
|
||||
@AutoConfigureAfter(GraphQLAutoConfiguration.class)
|
||||
public class WebMvcGraphQLAutoConfiguration {
|
||||
|
||||
private static final Log logger = LogFactory.getLog(WebMvcGraphQLAutoConfiguration.class);
|
||||
|
||||
@Bean
|
||||
public GraphQL graphQL(GraphQL.Builder graphQLBuilder) {
|
||||
return graphQLBuilder.build();
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
public GraphQLHttpHandler graphQLHandler(GraphQL graphQL,
|
||||
ObjectProvider<WebInterceptor> interceptors) {
|
||||
public GraphQLHttpHandler graphQLHandler(GraphQL graphQL, ObjectProvider<WebInterceptor> interceptors) {
|
||||
return new GraphQLHttpHandler(graphQL, interceptors.orderedStream().collect(Collectors.toList()));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user