@@ -290,7 +290,8 @@ public GraphQLObjectMapper graphQLObjectMapper(
290290 @ Bean
291291 @ ConditionalOnMissingBean
292292 @ ConditionalOnProperty (
293- value = "graphql.servlet.use-default-objectmapper" ,
293+ prefix = "graphql.servlet" ,
294+ name = "use-default-objectmapper" ,
294295 havingValue = "true" ,
295296 matchIfMissing = true )
296297 public ObjectMapperProvider objectMapperProvider (ObjectMapper objectMapper ) {
@@ -314,10 +315,6 @@ public GraphQLConfiguration graphQLServletConfiguration(
314315 Duration asyncTimeout =
315316 Optional .ofNullable (asyncServletProperties .getTimeout ()) //
316317 .orElse (AsyncServletProperties .DEFAULT_TIMEOUT );
317- long asyncTimeoutMilliseconds =
318- Optional .ofNullable (graphQLServletProperties .getAsyncTimeout ()) //
319- .orElse (asyncTimeout )
320- .toMillis ();
321318 long subscriptionTimeoutMilliseconds =
322319 Optional .ofNullable (graphQLServletProperties .getSubscriptionTimeout ()) //
323320 .orElse (GraphQLServletProperties .DEFAULT_SUBSCRIPTION_TIMEOUT )
@@ -330,7 +327,7 @@ public GraphQLConfiguration graphQLServletConfiguration(
330327 .with (batchInputPreProcessor )
331328 .with (graphQLServletProperties .getContextSetting ())
332329 .with (responseCacheManager )
333- .asyncTimeout (asyncTimeoutMilliseconds )
330+ .asyncTimeout (asyncTimeout . toMillis () )
334331 .with (asyncTaskDecorator )
335332 .asyncCorePoolSize (asyncServletProperties .getThreads ().getMin ())
336333 .asyncMaxPoolSize (asyncServletProperties .getThreads ().getMax ())
@@ -340,22 +337,14 @@ public GraphQLConfiguration graphQLServletConfiguration(
340337
341338 @ Bean ("graphqlAsyncTaskExecutor" )
342339 @ ConditionalOnMissingBean (name = "graphqlAsyncTaskExecutor" )
340+ @ ConditionalOnProperty (prefix = "graphql.servlet.async" , name = "enabled" , havingValue = "true" )
343341 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 ;
359348 }
360349
361350 @ Bean
@@ -375,11 +364,7 @@ public ServletRegistrationBean<AbstractGraphQLHttpServlet> graphQLServletRegistr
375364 } else {
376365 registration .setMultipartConfig (new MultipartConfigElement ("" ));
377366 }
378- if (graphQLServletProperties .getAsyncModeEnabled () != null ) {
379- registration .setAsyncSupported (graphQLServletProperties .getAsyncModeEnabled ());
380- } else {
381- registration .setAsyncSupported (asyncServletProperties .isEnabled ());
382- }
367+ registration .setAsyncSupported (asyncServletProperties .isEnabled ());
383368 return registration ;
384369 }
385370}
0 commit comments