Skip to content

only build GraphQL once #37

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,16 @@ 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.Builder graphQLBuilder, ObjectProvider<WebInterceptor> interceptors) {
return new GraphQLHttpHandler(graphQLBuilder.build(), interceptors.orderedStream().collect(Collectors.toList()));
public GraphQLHttpHandler graphQLHandler(GraphQL graphQL, ObjectProvider<WebInterceptor> interceptors) {
return new GraphQLHttpHandler(graphQL, interceptors.orderedStream().collect(Collectors.toList()));
}

@Bean
public RouterFunction<ServerResponse> graphQLEndpoint(
GraphQLHttpHandler handler, GraphQLProperties properties, ResourceLoader resourceLoader) {
Expand All @@ -88,11 +91,11 @@ static class WebSocketConfiguration {
@Bean
@ConditionalOnMissingBean
public GraphQLWebSocketHandler graphQLWebSocketHandler(
GraphQL.Builder graphQLBuilder, GraphQLProperties properties, ServerCodecConfigurer configurer,
GraphQL graphql, GraphQLProperties properties, ServerCodecConfigurer configurer,
ObjectProvider<WebInterceptor> interceptors) {

return new GraphQLWebSocketHandler(
graphQLBuilder.build(), interceptors.orderedStream().collect(Collectors.toList()),
graphql, interceptors.orderedStream().collect(Collectors.toList()),
configurer, properties.getWebsocket().getConnectionInitTimeout()
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,16 @@ 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.Builder graphQLBuilder,
public GraphQLHttpHandler graphQLHandler(GraphQL graphQL,
ObjectProvider<WebInterceptor> interceptors) {
return new GraphQLHttpHandler(graphQLBuilder.build(), interceptors.orderedStream().collect(Collectors.toList()));
return new GraphQLHttpHandler(graphQL, interceptors.orderedStream().collect(Collectors.toList()));
}

@Bean
Expand Down Expand Up @@ -98,7 +102,7 @@ static class WebSocketConfiguration {
@Bean
@ConditionalOnMissingBean
public GraphQLWebSocketHandler graphQLWebSocketHandler(
GraphQL.Builder graphQLBuilder, GraphQLProperties properties, HttpMessageConverters converters,
GraphQL graphQL, GraphQLProperties properties, HttpMessageConverters converters,
ObjectProvider<WebInterceptor> interceptors) {

HttpMessageConverter<?> converter = converters.getConverters().stream()
Expand All @@ -107,7 +111,7 @@ public GraphQLWebSocketHandler graphQLWebSocketHandler(
.orElseThrow(() -> new IllegalStateException("No JSON converter"));

return new GraphQLWebSocketHandler(
graphQLBuilder.build(), interceptors.orderedStream().collect(Collectors.toList()),
graphQL, interceptors.orderedStream().collect(Collectors.toList()),
converter, properties.getWebsocket().getConnectionInitTimeout()
);
}
Expand Down