Skip to content
This repository was archived by the owner on Dec 19, 2023. It is now read-only.

Commit 70d53c4

Browse files
committed
chore: remove deprecated asyncModeEnabled property
1 parent 6ca329f commit 70d53c4

File tree

2 files changed

+12
-27
lines changed

2 files changed

+12
-27
lines changed

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ TARGET_COMPATIBILITY=1.8
3232
LIB_GRAPHQL_JAVA_VER=18.3
3333
LIB_EXTENDED_SCALARS_VER=18.1
3434
LIB_SPRING_BOOT_VER=2.7.2
35-
LIB_GRAPHQL_SERVLET_VER=14.0.0-SNAPSHOT
35+
LIB_GRAPHQL_SERVLET_VER=13.0.1-SNAPSHOT
3636
LIB_GRAPHQL_JAVA_TOOLS_VER=12.1.0
3737
LIB_GRAPHQL_ANNOTATIONS_VER=9.1
3838
LIB_REFLECTIONS_VER=0.10.2

graphql-spring-boot-autoconfigure/src/main/java/graphql/kickstart/autoconfigure/web/servlet/GraphQLWebAutoConfiguration.java

Lines changed: 11 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)