@@ -201,9 +201,25 @@ the following:
201
201
- Detect <<execution-graphqlsource-runtimewiring-configurer>> beans.
202
202
- Detect https://www.graphql-java.com/documentation/instrumentation[Instrumentation] beans for
203
203
{spring-boot-ref-docs}/actuator.html#actuator.metrics.supported.spring-graphql[GraphQL metrics].
204
- - Detect `DataFetcherExceptionResolver` beans for
205
- <<execution-exceptions, exception resolution>>.
206
- - Detect `GraphQlSourceBuilderCustomizer` beans for any other customizations.
204
+ - Detect `DataFetcherExceptionResolver` beans for <<execution-exceptions, exception resolution>>.
205
+
206
+ For further customizations, you can declare your own `GraphQlSourceBuilderCustomizer` beans;
207
+ for example, for configuring your own `ExecutionIdProvider`:
208
+
209
+ [source,java,indent=0,subs="verbatim,quotes"]
210
+ ----
211
+ @Configuration(proxyBeanMethods = false)
212
+ class GraphQlConfig {
213
+
214
+ @Bean
215
+ public GraphQlSourceBuilderCustomizer sourceBuilderCustomizer() {
216
+ return (builder) -> {
217
+ builder.configureGraphQl(graphQlBuilder ->
218
+ graphQlBuilder.executionIdProvider(new CustomExecutionIdProvider()));
219
+ };
220
+ }
221
+ }
222
+ ----
207
223
208
224
209
225
@@ -230,18 +246,18 @@ necessary, you can hook into the schema creation through the builder:
230
246
231
247
[source,java,indent=0,subs="verbatim,quotes"]
232
248
----
233
- // Typically, accessed through Spring Boot's GraphQlSourceBuilderCustomizer
234
249
GraphQlSource.Builder builder = ...
235
250
236
251
builder.schemaResources(..)
237
252
.configureRuntimeWiring(..)
238
253
.schemaFactory((typeDefinitionRegistry, runtimeWiring) -> {
239
- // create ` GraphQLSchema`
254
+ // create GraphQLSchema
240
255
})
241
256
----
242
257
243
258
The primary reason for this is to create the schema through a federation library.
244
259
260
+ The <<execution-graphqlsource, GraphQlSource section>> explains how to configure that with Spring Boot.
245
261
246
262
[[execution-graphqlsource-runtimewiring-configurer]]
247
263
==== `RuntimeWiringConfigurer`
@@ -302,8 +318,19 @@ returned from the `DataFetcher` for a GraphQL Interface or Union field.
302
318
Object Type and if it is not successful, it also navigates its super types including
303
319
base classes and interfaces, looking for a match. `ClassNameTypeResolver` provides an
304
320
option to configure a name extracting function along with `Class` to GraphQL Object type
305
- name mappings that should help to cover more corner cases.
321
+ name mappings that should help to cover more corner cases:
322
+
323
+ [source,java,indent=0,subs="verbatim,quotes"]
324
+ ----
325
+ GraphQlSource.Builder builder = ...
326
+ ClassNameTypeResolver classNameTypeResolver = new ClassNameTypeResolver();
327
+ classNameTypeResolver.setClassNameExtractor((klass) -> {
328
+ // Implement Custom ClassName Extractor here
329
+ });
330
+ builder.defaultTypeResolver(classNameTypeResolver);
331
+ ----
306
332
333
+ The <<execution-graphqlsource, GraphQlSource section>> explains how to configure that with Spring Boot.
307
334
308
335
[[execution-graphqlsource-operation-caching]]
309
336
==== Operation Caching
@@ -331,6 +358,7 @@ builder.schemaResources(..)
331
358
.configureGraphQl(graphQLBuilder -> graphQLBuilder.preparsedDocumentProvider(provider))
332
359
----
333
360
361
+ The <<execution-graphqlsource, GraphQlSource section>> explains how to configure that with Spring Boot.
334
362
335
363
[[execution-graphqlsource-directives]]
336
364
==== Directives
0 commit comments