|
34 | 34 | import graphql.servlet.DefaultExecutionStrategyProvider; |
35 | 35 | import graphql.servlet.DefaultGraphQLSchemaProvider; |
36 | 36 | import graphql.servlet.ExecutionStrategyProvider; |
| 37 | +import graphql.servlet.GraphQLBatchExecutionHandlerFactory; |
37 | 38 | import graphql.servlet.GraphQLConfiguration; |
38 | 39 | import graphql.servlet.GraphQLContextBuilder; |
39 | 40 | import graphql.servlet.GraphQLErrorHandler; |
@@ -126,6 +127,9 @@ public class GraphQLWebAutoConfiguration implements ApplicationContextAware { |
126 | 127 | @Autowired(required = false) |
127 | 128 | private MultipartConfigElement multipartConfigElement; |
128 | 129 |
|
| 130 | + @Autowired(required = false) |
| 131 | + private GraphQLBatchExecutionHandlerFactory graphQLBatchExecutionHandlerFactory; |
| 132 | + |
129 | 133 | @Override |
130 | 134 | public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { |
131 | 135 | if (errorHandler == null) { |
@@ -251,18 +255,23 @@ public ObjectMapperProvider objectMapperProvider(ObjectMapper objectMapper) { |
251 | 255 | return () -> objectMapper; |
252 | 256 | } |
253 | 257 |
|
| 258 | + @Bean |
| 259 | + @ConditionalOnMissingBean |
| 260 | + public GraphQLConfiguration graphQLConfiguration(GraphQLInvocationInputFactory invocationInputFactory, GraphQLQueryInvoker queryInvoker, GraphQLObjectMapper graphQLObjectMapper) { |
| 261 | + return GraphQLConfiguration.with(invocationInputFactory) |
| 262 | + .with(queryInvoker) |
| 263 | + .with(graphQLObjectMapper) |
| 264 | + .with(listeners) |
| 265 | + .with(graphQLServletProperties.isAsyncModeEnabled()) |
| 266 | + .with(graphQLServletProperties.getSubscriptionTimeout()) |
| 267 | + .with(graphQLBatchExecutionHandlerFactory) |
| 268 | + .build(); |
| 269 | + } |
254 | 270 |
|
255 | 271 | @Bean |
256 | 272 | @ConditionalOnMissingBean |
257 | | - public GraphQLHttpServlet graphQLHttpServlet(GraphQLInvocationInputFactory invocationInputFactory, GraphQLQueryInvoker queryInvoker, GraphQLObjectMapper graphQLObjectMapper) { |
258 | | - GraphQLConfiguration configuration = GraphQLConfiguration.with(invocationInputFactory) |
259 | | - .with(queryInvoker) |
260 | | - .with(graphQLObjectMapper) |
261 | | - .with(listeners) |
262 | | - .with(graphQLServletProperties.isAsyncModeEnabled()) |
263 | | - .with(graphQLServletProperties.getSubscriptionTimeout()) |
264 | | - .build(); |
265 | | - return GraphQLHttpServlet.with(configuration); |
| 273 | + public GraphQLHttpServlet graphQLHttpServlet(GraphQLConfiguration graphQLConfiguration) { |
| 274 | + return GraphQLHttpServlet.with(graphQLConfiguration); |
266 | 275 | } |
267 | 276 |
|
268 | 277 | @Bean |
|
0 commit comments