|
10 | 10 | import graphql.kickstart.tools.PerFieldObjectMapperProvider; |
11 | 11 | import graphql.kickstart.tools.SchemaParser; |
12 | 12 | import graphql.kickstart.tools.SchemaParserBuilder; |
| 13 | +import graphql.kickstart.tools.SchemaParserDictionary; |
13 | 14 | import graphql.kickstart.tools.SchemaParserOptions; |
14 | 15 | import graphql.kickstart.tools.SchemaParserOptions.GenericWrapper; |
15 | 16 | import graphql.kickstart.tools.TypeDefinitionFactory; |
|
34 | 35 | import org.springframework.context.annotation.Bean; |
35 | 36 | import org.springframework.context.annotation.Configuration; |
36 | 37 |
|
| 38 | +import static java.util.Objects.nonNull; |
| 39 | + |
37 | 40 | /** |
38 | 41 | * @author Andrew Potter |
39 | 42 | */ |
|
45 | 48 | public class GraphQLJavaToolsAutoConfiguration { |
46 | 49 |
|
47 | 50 | @Autowired(required = false) |
48 | | - private SchemaParserBuilder schemaParserBuilder; |
| 51 | + private SchemaParserDictionary dictionary; |
49 | 52 |
|
50 | 53 | @Autowired(required = false) |
51 | 54 | private GraphQLScalarType[] scalars; |
@@ -87,7 +90,7 @@ public SchemaStringProvider schemaStringProvider() { |
87 | 90 | @ConditionalOnMissingBean |
88 | 91 | @ConfigurationProperties("graphql.tools.schema-parser-options") |
89 | 92 | public SchemaParserOptions.Builder optionsBuilder( |
90 | | - PerFieldObjectMapperProvider perFieldObjectMapperProvider |
| 93 | + @Autowired(required = false) PerFieldObjectMapperProvider perFieldObjectMapperProvider |
91 | 94 | ) { |
92 | 95 | SchemaParserOptions.Builder optionsBuilder = SchemaParserOptions.newOptions(); |
93 | 96 |
|
@@ -122,8 +125,10 @@ public SchemaParser schemaParser( |
122 | 125 | SchemaStringProvider schemaStringProvider, |
123 | 126 | SchemaParserOptions.Builder optionsBuilder |
124 | 127 | ) throws IOException { |
125 | | - SchemaParserBuilder builder = schemaParserBuilder != null ? schemaParserBuilder : new SchemaParserBuilder(); |
126 | | - |
| 128 | + SchemaParserBuilder builder = new SchemaParserBuilder(); |
| 129 | + if (nonNull(dictionary)) { |
| 130 | + builder.dictionary(dictionary.getDictionary()); |
| 131 | + } |
127 | 132 | List<String> schemaStrings = schemaStringProvider.schemaStrings(); |
128 | 133 | schemaStrings.forEach(builder::schemaString); |
129 | 134 |
|
|
0 commit comments