1
1
package graphql .kickstart .tools .boot ;
2
2
3
+ import com .fasterxml .jackson .databind .ObjectMapper ;
4
+ import com .fasterxml .jackson .datatype .jdk8 .Jdk8Module ;
5
+ import com .fasterxml .jackson .module .kotlin .KotlinModule ;
6
+ import graphql .kickstart .tools .CoroutineContextProvider ;
3
7
import graphql .kickstart .tools .GraphQLResolver ;
8
+ import graphql .kickstart .tools .ObjectMapperConfigurer ;
4
9
import graphql .kickstart .tools .PerFieldObjectMapperProvider ;
10
+ import graphql .kickstart .tools .ProxyHandler ;
5
11
import graphql .kickstart .tools .SchemaParser ;
6
12
import graphql .kickstart .tools .SchemaParserBuilder ;
7
13
import graphql .kickstart .tools .SchemaParserDictionary ;
8
14
import graphql .kickstart .tools .SchemaParserOptions ;
15
+ import graphql .kickstart .tools .SchemaParserOptions .GenericWrapper ;
9
16
import graphql .kickstart .tools .TypeDefinitionFactory ;
10
- import com .fasterxml .jackson .databind .ObjectMapper ;
11
- import com .fasterxml .jackson .datatype .jdk8 .Jdk8Module ;
12
- import com .fasterxml .jackson .module .kotlin .KotlinModule ;
13
17
import graphql .kickstart .execution .config .GraphQLSchemaProvider ;
14
18
import graphql .schema .GraphQLScalarType ;
15
19
import graphql .schema .GraphQLSchema ;
16
20
import graphql .schema .idl .SchemaDirectiveWiring ;
17
21
import java .io .IOException ;
18
22
import java .util .List ;
23
+
24
+ import kotlin .coroutines .CoroutineContext ;
19
25
import lombok .extern .slf4j .Slf4j ;
20
26
import org .springframework .beans .factory .annotation .Autowired ;
21
27
import org .springframework .boot .autoconfigure .AutoConfigureAfter ;
@@ -51,6 +57,18 @@ public class GraphQLJavaToolsAutoConfiguration {
51
57
@ Autowired (required = false )
52
58
private List <SchemaDirectiveWiring > directiveWirings ;
53
59
60
+ @ Autowired (required = false )
61
+ private List <GenericWrapper > genericWrappers ;
62
+
63
+ @ Autowired (required = false )
64
+ private ObjectMapperConfigurer objectMapperConfigurer ;
65
+
66
+ @ Autowired (required = false )
67
+ private List <ProxyHandler > proxyHandlers ;
68
+
69
+ @ Autowired (required = false )
70
+ private CoroutineContextProvider coroutineContextProvider ;
71
+
54
72
@ Autowired (required = false )
55
73
private List <TypeDefinitionFactory > typeDefinitionFactories ;
56
74
@@ -73,9 +91,24 @@ public SchemaParserOptions.Builder optionsBuilder(
73
91
74
92
if (perFieldObjectMapperProvider != null ) {
75
93
optionsBuilder .objectMapperProvider (perFieldObjectMapperProvider );
94
+ } else {
95
+ optionsBuilder .objectMapperConfigurer (objectMapperConfigurer );
76
96
}
97
+
77
98
optionsBuilder .introspectionEnabled (props .isIntrospectionEnabled ());
78
99
100
+ if (genericWrappers != null ) {
101
+ optionsBuilder .genericWrappers (genericWrappers );
102
+ }
103
+
104
+ if (proxyHandlers != null ) {
105
+ proxyHandlers .forEach (optionsBuilder ::addProxyHandler );
106
+ }
107
+
108
+ if (coroutineContextProvider != null ) {
109
+ optionsBuilder .coroutineContextProvider (coroutineContextProvider );
110
+ }
111
+
79
112
if (typeDefinitionFactories != null ) {
80
113
typeDefinitionFactories .forEach (optionsBuilder ::typeDefinitionFactory );
81
114
}
0 commit comments