@@ -191,17 +191,34 @@ The default `GraphQlSource` builder, accessible via `GraphQlSource.builder()`, e
191
191
support for <<execution-reactive-datafetcher>>, <<execution-context>>, and
192
192
<<execution-exceptions>>.
193
193
194
+ The Spring Boot {spring-boot-ref-docs}/web.html#web.graphql[starter] initializes a
195
+ `GraphQlSource` instance through the default `GraphQlSource.Builder` and also enables
196
+ the following:
197
+
198
+ - Load <<execution-graphqlsource-schema-resources, schema files>> from a configurable location.
199
+ - Expose {spring-boot-ref-docs}/application-properties.html#appendix.application-properties.web[properties]
200
+ that apply to `GraphQlSource.Builder`.
201
+ - Detect <<execution-graphqlsource-runtimewiring-configurer>> beans.
202
+ - Detect `Instrumentation` beans for GraphQL
203
+ {spring-boot-ref-docs}/actuator.html#actuator.metrics.supported.spring-graphql[metrics].
204
+ - Detect `DataFetcherExceptionResolver` beans for
205
+ <<execution-exceptions, exception resolution>>.
206
+ - Detect `GraphQlSourceBuilderCustomizer` beans for any other customizations.
207
+
208
+
194
209
195
210
[[execution-graphqlsource-schema-resources]]
196
211
==== Schema Resources
197
212
198
213
`GraphQlSource.Builder` can be configured with one or more `Resource` instances to be
199
214
parsed and merged together. That means schema files can be loaded from just about any
200
- location. By default, the Spring Boot starter
201
- {spring-boot-ref-docs}/web.html#web.graphql.schema[loads schema files]
202
- from a well-known classpath location, but you can change that to a location on the file
203
- system via `FileSystemResource`, to byte content via `ByteArrayResource`, or implement a
204
- custom `Resource` that loads schema files from a remote location or storage.
215
+ location.
216
+
217
+ By default, the Spring Boot starter
218
+ {spring-boot-ref-docs}/web.html#web.graphql.schema[finds schema files] from a
219
+ well-known classpath location, but you can change that to a location on the file system
220
+ via `FileSystemResource`, to byte content via `ByteArrayResource`, or implement a custom
221
+ `Resource` that loads schema files from a remote location or storage.
205
222
206
223
207
224
[[execution-graphqlsource-schema-creation]]
@@ -213,13 +230,14 @@ necessary, you can hook into the schema creation through the builder:
213
230
214
231
[source,java,indent=0,subs="verbatim,quotes"]
215
232
----
216
- GraphQlSource graphQlSource = GraphQlSource.builder()
217
- .schemaResources(..)
233
+ // Typically, accessed through Spring Boot's GraphQlSourceBuilderCustomizer
234
+ GraphQlSource.Builder builder = ...
235
+
236
+ builder.schemaResources(..)
218
237
.configureRuntimeWiring(..)
219
238
.schemaFactory((typeDefinitionRegistry, runtimeWiring) -> {
220
239
// create `GraphQLSchema`
221
240
})
222
- .build();
223
241
----
224
242
225
243
The primary reason for this is to create the schema through a federation library.
@@ -238,7 +256,7 @@ You can use `RuntimeWiringConfigurer` to register:
238
256
`AnnotatedControllerConfigurer`, which detects annotated, `DataFetcher` handler methods.
239
257
The Spring Boot starter adds the `AnnotatedControllerConfigurer` by default.
240
258
241
- The Spring for GraphQL Boot starter detects beans of type `RuntimeWiringConfigurer` and
259
+ The Spring Boot starter detects beans of type `RuntimeWiringConfigurer` and
242
260
registers them in the `GraphQlSource.Builder`. That means in most cases, you'll' have
243
261
something like the following in your configuration:
244
262
0 commit comments