Skip to content

Commit 59168a2

Browse files
committed
Add GraphQLInvoker to GraphQLConfiguration
1 parent 6076934 commit 59168a2

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

graphql-java-servlet/src/main/java/graphql/kickstart/servlet/GraphQLConfiguration.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,15 @@ public class GraphQLConfiguration {
3535
private HttpRequestHandler requestHandler;
3636

3737
private GraphQLConfiguration(GraphQLInvocationInputFactory invocationInputFactory,
38+
GraphQLInvoker graphQLInvoker,
3839
GraphQLQueryInvoker queryInvoker,
3940
GraphQLObjectMapper objectMapper, List<GraphQLServletListener> listeners,
4041
long subscriptionTimeout, long asyncTimeout,
4142
ContextSetting contextSetting,
4243
Supplier<BatchInputPreProcessor> batchInputPreProcessor,
4344
GraphQLResponseCacheManager responseCacheManager) {
4445
this.invocationInputFactory = invocationInputFactory;
45-
this.graphQLInvoker = queryInvoker.toGraphQLInvoker();
46+
this.graphQLInvoker = graphQLInvoker != null ? graphQLInvoker : queryInvoker.toGraphQLInvoker();
4647
this.objectMapper = objectMapper;
4748
this.listeners = listeners;
4849
this.subscriptionTimeout = subscriptionTimeout;
@@ -124,6 +125,7 @@ public static class Builder {
124125

125126
private GraphQLInvocationInputFactory.Builder invocationInputFactoryBuilder;
126127
private GraphQLInvocationInputFactory invocationInputFactory;
128+
private GraphQLInvoker graphQLInvoker;
127129
private GraphQLQueryInvoker queryInvoker = GraphQLQueryInvoker.newBuilder().build();
128130
private GraphQLObjectMapper objectMapper = GraphQLObjectMapper.newBuilder().build();
129131
private List<GraphQLServletListener> listeners = new ArrayList<>();
@@ -141,6 +143,11 @@ private Builder(GraphQLInvocationInputFactory invocationInputFactory) {
141143
this.invocationInputFactory = invocationInputFactory;
142144
}
143145

146+
public Builder with(GraphQLInvoker graphQLInvoker) {
147+
this.graphQLInvoker = graphQLInvoker;
148+
return this;
149+
}
150+
144151
public Builder with(GraphQLQueryInvoker queryInvoker) {
145152
if (queryInvoker != null) {
146153
this.queryInvoker = queryInvoker;
@@ -212,6 +219,7 @@ public GraphQLConfiguration build() {
212219
return new GraphQLConfiguration(
213220
this.invocationInputFactory != null ? this.invocationInputFactory
214221
: invocationInputFactoryBuilder.build(),
222+
graphQLInvoker,
215223
queryInvoker,
216224
objectMapper,
217225
listeners,

0 commit comments

Comments
 (0)