Skip to content

Commit

Permalink
Polishing contribution
Browse files Browse the repository at this point in the history
Closes gh-37
  • Loading branch information
rstoyanchev committed Apr 7, 2021
1 parent b6f79f2 commit 9ceaaf5
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 16 deletions.
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -43,9 +43,21 @@
@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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,17 +52,12 @@
@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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,21 +59,15 @@
@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()));
}

Expand Down

0 comments on commit 9ceaaf5

Please sign in to comment.