You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/server/spring-beans.md
+23-34Lines changed: 23 additions & 34 deletions
Original file line number
Diff line number
Diff line change
@@ -3,47 +3,36 @@ id: spring-beans
3
3
title: Automatically Created Beans
4
4
---
5
5
6
-
All beans created by `graphql-kotlin-spring-server`are conditionally created. If any of the target beans are created in
7
-
the application context, auto-configuration will back off.
6
+
`graphql-kotlin-spring-server`automatically creates all required beans to start GraphQL web server. Many of the beans are conditionally created and default behavior
7
+
can be customized by providing custom beans in your application context. See sections below for the information about all automatically created beans.
8
8
9
-
Conditionally generated beans:
9
+
## Schema Generation
10
10
11
-
***SchemaGeneratorConfig/FederatedSchemaGeneratorConfig** - schema generation configuration information, see
12
-
[Spring Configuration](spring-config) for details. _You should
13
-
register custom configuration bean if you want to specify custom schema generator hooks._
14
-
***FederatedTypeRegistry** - default type registry without any resolvers, created only if generating federated GraphQL
15
-
schema. _You should register your custom type registry bean whenever implementing federated GraphQL schema with
16
-
extended types_.
17
-
***GraphQLSchema** - GraphQL schema generated based on the schema generator configuration and `Query`, `Mutation` and
18
-
`Subscription` objects available in the application context
19
-
***DataFetcherExceptionHandler** - GraphQL exception handler used from the various execution strategies, defaults to
***DataLoaderRegistryFactory** - factory used to create DataLoaderRegistry instance per query execution. See [graphql-java documentation](https://www.graphql-java.com/documentation/v13/batching/)
29
-
for more details
30
-
***QueryHandler** - handler invoked from GraphQL query route that executes the incoming request, defaults to
created only if `Subscription` bean is available in the context
11
+
| Bean | Description |
12
+
|:-------------------------------|:------------|
13
+
| SchemaGeneratorConfig | Schema generator configuration information, see [Schema Generator Configuration](https://expediagroup.github.io/graphql-kotlin/docs/writing-schemas/generator-config) for details. Can be customized by providing `TopLevelNames`, [SchemaGeneratorHooks](https://expediagroup.github.io/graphql-kotlin/docs/writing-schemas/generator-config#schema-generator-hooks) and `KotlinDataFetcherFactoryProvider` beans. |
14
+
| FederatedTypeRegistry | Default type registry without any resolvers. See [Federated Type Resolution](https://expediagroup.github.io/graphql-kotlin/docs/federated/type-resolution) for more details.<br><br>_Created only if federation is enabled. You should register your custom type registry bean whenever implementing federated GraphQL schema with extended types_. |
15
+
| FederatedSchemaGeneratorHooks | Schema generator hooks used to build federated schema.<br><br>_Created only if federation is enabled_. |
16
+
| FederatedSchemaGeneratorConfig | Federated schema generator configuration information. You can customize the configuration by providing `TopLevelNames`, `FederatedSchemaGeneratorHooks` and `KotlinDataFetcherFactoryProvider` beans.<br><br>_Created instead of default `SchemaGeneratorConfig` if federation is enabled_. |
17
+
| GraphQLSchema | GraphQL schema generated based on the schema generator configuration and `Query`, `Mutation` and `Subscription` objects available in the application context. |
18
+
19
+
## Execution
20
+
21
+
| Bean | Description |
22
+
|:-------------------------------|:------------|
23
+
| DataFetcherExceptionHandler | GraphQL exception handler used from the various execution strategies, defaults to [KotlinDataFetcherExceptionHandler](https://github.com/ExpediaGroup/graphql-kotlin/blob/master/graphql-kotlin-spring-server/src/main/kotlin/com/expediagroup/graphql/spring/exception/KotlinDataFetcherExceptionHandler.kt). |
24
+
| GraphQL | GraphQL query execution engine generated using `GraphQLSchema` with default async execution strategies. GraphQL engine can be customized by optionally providing a list of [Instrumentation](https://www.graphql-java.com/documentation/v13/instrumentation/) beans (which can be ordered by implementing Spring Ordered interface), [ExecutionIdProvider](https://github.com/graphql-java/graphql-java/blob/master/src/main/java/graphql/execution/ExecutionIdProvider.java) and [PreparsedDocumentProvider](https://github.com/graphql-java/graphql-java/blob/master/src/main/java/graphql/execution/preparsed/PreparsedDocumentProvider.java) in the application context. |
25
+
| DataLoaderRegistryFactory | Factory used to create DataLoaderRegistry instance per query execution. See [graphql-java documentation](https://www.graphql-java.com/documentation/v13/batching/) for more details. |
26
+
| QueryHandler | Handler invoked from GraphQL query route that executes the incoming request, defaults to [SimpleQueryHandler](https://github.com/ExpediaGroup/graphql-kotlin/blob/master/graphql-kotlin-spring-server/src/main/kotlin/com/expediagroup/graphql/spring/execution/QueryHandler.kt). |
27
+
| GraphQLContextFactory | Factory used by context WebFilter to generate GraphQL context based on the incoming request. GraphQL context can be any object. Defaults to empty [GraphQLContext](https://github.com/graphql-java/graphql-java/blob/master/src/main/java/graphql/GraphQLContext.java). |
28
+
| SubscriptionHandler | Web socket handler for executing GraphQL subscriptions, defaults to [SimpleSubscriptionHandler](https://github.com/ExpediaGroup/graphql-kotlin/blob/master/graphql-kotlin-spring-server/src/main/kotlin/com/expediagroup/graphql/spring/execution/SubscriptionHandler.kt#L49).<br><br>_Created only if `Subscription` bean is available in the context._|
29
+
| WebSocketHandlerAdapter | See [Spring documentation](https://docs.spring.io/spring/docs/current/javadoc-api/org/springframework/web/reactive/socket/server/support/WebSocketHandlerAdapter.html).<br><br>_Created only if `Subscription` bean is available in the context._|
41
30
42
31
The following beans are currently automatically created and cannot be disabled:
43
32
44
33
* Web filter for generating and populating GraphQL context
45
34
* Default routes for GraphQL queries/mutations and SDL endpoint
46
-
* Default route for Prisma Labs Playground, created only if playground is enabled
35
+
* Default route for [Prisma Labs Playground](https://github.com/prisma-labs/graphql-playground), created only if playground is enabled
47
36
* Default `ApolloSubscriptionProtocolHandler` for handling GraphQL subscriptions, created only if `Subscription` bean is available in the context
48
37
* Default `SubscriptionWebSocketHandler` that utilizes above subscription protocol handler, created only if `Subscription` bean is available in the context
49
38
* Default subscription handler mapping, created only if `Subscription` bean is available in the context
| graphql.subscriptions.keepAliveInterval | Keep the websocket alive and send a message to the client every interval in ms. Defaults to not sending messages | null |
18
-
| graphql.playground.enabled | Boolean flag indicating whether to enabled Prisma Labs Playground GraphQL IDE ||
18
+
| graphql.playground.enabled | Boolean flag indicating whether to enabled Prisma Labs Playground GraphQL IDE |true |
0 commit comments