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

Commit ceece7d

Browse files
authored
Merge pull request #139 from graphql-java-kickstart/bugfix/129-async-mode-pro
Added property for configuring servlet async mode (fix #129)
2 parents 9ea3e46 + 05b48be commit ceece7d

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

graphql-spring-boot-autoconfigure/src/main/java/com/oembedler/moon/graphql/boot/GraphQLServletProperties.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ public class GraphQLServletProperties {
3232

3333
private String mapping;
3434

35+
private boolean asyncModeEnabled = false;
36+
3537
public String getMapping() {
3638
return mapping != null ? mapping : "/graphql";
3739
}
@@ -75,4 +77,8 @@ public String getCorsMapping() {
7577
public void setMapping(String mapping) {
7678
this.mapping = mapping;
7779
}
80+
81+
public boolean isAsyncModeEnabled() {
82+
return asyncModeEnabled;
83+
}
7884
}

graphql-spring-boot-autoconfigure/src/main/java/com/oembedler/moon/graphql/boot/GraphQLWebAutoConfiguration.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,6 @@ public GraphQLObjectMapper graphQLObjectMapper(Optional<ObjectMapperProvider> ob
226226
@ConditionalOnProperty(value="graphql.servlet.use-default-objectmapper", havingValue = "true",
227227
matchIfMissing = true)
228228
public ObjectMapperProvider objectMapperProvider(ObjectMapper objectMapper) {
229-
230229
InjectableValues.Std injectableValues = new InjectableValues.Std();
231230
injectableValues.addValue(ObjectMapper.class, objectMapper);
232231
objectMapper.setInjectableValues(injectableValues);
@@ -242,6 +241,7 @@ public SimpleGraphQLHttpServlet graphQLHttpServlet(GraphQLInvocationInputFactory
242241
.withQueryInvoker(queryInvoker)
243242
.withObjectMapper(graphQLObjectMapper)
244243
.withListeners(listeners)
244+
.withAsyncServletMode(graphQLServletProperties.isAsyncModeEnabled())
245245
.build();
246246
}
247247

graphql-spring-boot-autoconfigure/src/main/resources/META-INF/additional-spring-configuration-metadata.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@
2020
"defaultValue": true,
2121
"type": "java.lang.Boolean"
2222
},
23+
{
24+
"name": "graphql.servlet.asyncModeEnabled",
25+
"defaultValue": false,
26+
"type": "java.lang.Boolean"
27+
},
2328
{
2429
"name": "graphql.servlet.subscriptions.websocket.path",
2530
"defaultValue": "/subscriptions",

0 commit comments

Comments
 (0)