@@ -290,7 +290,8 @@ public GraphQLObjectMapper graphQLObjectMapper(
290
290
@ Bean
291
291
@ ConditionalOnMissingBean
292
292
@ ConditionalOnProperty (
293
- value = "graphql.servlet.use-default-objectmapper" ,
293
+ prefix = "graphql.servlet" ,
294
+ name = "use-default-objectmapper" ,
294
295
havingValue = "true" ,
295
296
matchIfMissing = true )
296
297
public ObjectMapperProvider objectMapperProvider (ObjectMapper objectMapper ) {
@@ -314,10 +315,6 @@ public GraphQLConfiguration graphQLServletConfiguration(
314
315
Duration asyncTimeout =
315
316
Optional .ofNullable (asyncServletProperties .getTimeout ()) //
316
317
.orElse (AsyncServletProperties .DEFAULT_TIMEOUT );
317
- long asyncTimeoutMilliseconds =
318
- Optional .ofNullable (graphQLServletProperties .getAsyncTimeout ()) //
319
- .orElse (asyncTimeout )
320
- .toMillis ();
321
318
long subscriptionTimeoutMilliseconds =
322
319
Optional .ofNullable (graphQLServletProperties .getSubscriptionTimeout ()) //
323
320
.orElse (GraphQLServletProperties .DEFAULT_SUBSCRIPTION_TIMEOUT )
@@ -330,7 +327,7 @@ public GraphQLConfiguration graphQLServletConfiguration(
330
327
.with (batchInputPreProcessor )
331
328
.with (graphQLServletProperties .getContextSetting ())
332
329
.with (responseCacheManager )
333
- .asyncTimeout (asyncTimeoutMilliseconds )
330
+ .asyncTimeout (asyncTimeout . toMillis () )
334
331
.with (asyncTaskDecorator )
335
332
.asyncCorePoolSize (asyncServletProperties .getThreads ().getMin ())
336
333
.asyncMaxPoolSize (asyncServletProperties .getThreads ().getMax ())
@@ -340,22 +337,14 @@ public GraphQLConfiguration graphQLServletConfiguration(
340
337
341
338
@ Bean ("graphqlAsyncTaskExecutor" )
342
339
@ ConditionalOnMissingBean (name = "graphqlAsyncTaskExecutor" )
340
+ @ ConditionalOnProperty (prefix = "graphql.servlet.async" , name = "enabled" , havingValue = "true" )
343
341
public Executor threadPoolTaskExecutor () {
344
- if (isAsyncModeEnabled ()) {
345
- ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor ();
346
- executor .setCorePoolSize (asyncServletProperties .getThreads ().getMin ());
347
- executor .setMaxPoolSize (asyncServletProperties .getThreads ().getMax ());
348
- executor .setThreadNamePrefix (asyncServletProperties .getThreads ().getNamePrefix ());
349
- executor .initialize ();
350
- return executor ;
351
- }
352
- return null ;
353
- }
354
-
355
- private boolean isAsyncModeEnabled () {
356
- return graphQLServletProperties .getAsyncModeEnabled () != null
357
- ? graphQLServletProperties .getAsyncModeEnabled ()
358
- : asyncServletProperties .isEnabled ();
342
+ ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor ();
343
+ executor .setCorePoolSize (asyncServletProperties .getThreads ().getMin ());
344
+ executor .setMaxPoolSize (asyncServletProperties .getThreads ().getMax ());
345
+ executor .setThreadNamePrefix (asyncServletProperties .getThreads ().getNamePrefix ());
346
+ executor .initialize ();
347
+ return executor ;
359
348
}
360
349
361
350
@ Bean
@@ -375,11 +364,7 @@ public ServletRegistrationBean<AbstractGraphQLHttpServlet> graphQLServletRegistr
375
364
} else {
376
365
registration .setMultipartConfig (new MultipartConfigElement ("" ));
377
366
}
378
- if (graphQLServletProperties .getAsyncModeEnabled () != null ) {
379
- registration .setAsyncSupported (graphQLServletProperties .getAsyncModeEnabled ());
380
- } else {
381
- registration .setAsyncSupported (asyncServletProperties .isEnabled ());
382
- }
367
+ registration .setAsyncSupported (asyncServletProperties .isEnabled ());
383
368
return registration ;
384
369
}
385
370
}
0 commit comments