Skip to content

Commit d792a62

Browse files
dariuszkucsmyrick
authored andcommitted
[docs] update spring-server configuration details (#436)
1 parent af11727 commit d792a62

File tree

2 files changed

+25
-36
lines changed

2 files changed

+25
-36
lines changed

docs/server/spring-beans.md

Lines changed: 23 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -3,47 +3,36 @@ id: spring-beans
33
title: Automatically Created Beans
44
---
55

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.
88

9-
Conditionally generated beans:
9+
## Schema Generation
1010

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
20-
[KotlinDataFetcherExceptionHandler](https://github.com/ExpediaGroup/graphql-kotlin/blob/master/graphql-kotlin-spring-server/src/main/kotlin/com/expediagroup/graphql/spring/exception/KotlinDataFetcherExceptionHandler.kt)
21-
* **GraphQL** - `graphql-java` GraphQL query execution engine generated using `GraphQLSchema` with default async
22-
execution strategies. GraphQL engine can be customized by optionally providing a list of
23-
[Instrumentation](https://www.graphql-java.com/documentation/v13/instrumentation/) beans (which can be ordered by implementing Spring
24-
Ordered interface), [ExecutionIdProvider](https://github.com/graphql-java/graphql-java/blob/master/src/main/java/graphql/execution/ExecutionIdProvider.java)
25-
and
26-
[PreparsedDocumentProvider](https://github.com/graphql-java/graphql-java/blob/master/src/main/java/graphql/execution/preparsed/PreparsedDocumentProvider.java)
27-
in the application context.
28-
* **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
31-
[SimpleQueryHandler](https://github.com/ExpediaGroup/graphql-kotlin/blob/master/graphql-kotlin-spring-server/src/main/kotlin/com/expediagroup/graphql/spring/execution/QueryHandler.kt)
32-
* **GraphQLContextFactory** - factory used by context WebFilter to generate GraphQL context based on the incoming
33-
request. GraphQL context can be any object. Defaults to empty
34-
[GraphQLContext](https://github.com/graphql-java/graphql-java/blob/master/src/main/java/graphql/GraphQLContext.java)
35-
* **SubscriptionHandler** - Web socket handler for executing GraphQL subscriptions, defaults to
36-
[SimpleSubscriptionHandler](https://github.com/ExpediaGroup/graphql-kotlin/blob/master/graphql-kotlin-spring-server/src/main/kotlin/com/expediagroup/graphql/spring/execution/SubscriptionHandler.kt#L49),
37-
created only if `Subscription` bean is available in the context
38-
* **WebSocketHandlerAdapter** - [see Spring
39-
documentation](https://docs.spring.io/spring/docs/current/javadoc-api/org/springframework/web/reactive/socket/server/support/WebSocketHandlerAdapter.html),
40-
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._ |
4130

4231
The following beans are currently automatically created and cannot be disabled:
4332

4433
* Web filter for generating and populating GraphQL context
4534
* 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
4736
* Default `ApolloSubscriptionProtocolHandler` for handling GraphQL subscriptions, created only if `Subscription` bean is available in the context
4837
* Default `SubscriptionWebSocketHandler` that utilizes above subscription protocol handler, created only if `Subscription` bean is available in the context
4938
* Default subscription handler mapping, created only if `Subscription` bean is available in the context

docs/server/spring-properties.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ details on the supported configuration properties.
1212
|----------|-------------|---------------|
1313
| graphql.endpoint | GraphQL server endpoint | "graphql" |
1414
| graphql.packages | List of supported packages that can contain GraphQL schema type definitions | |
15-
| graphql.federation.enabled | Boolean flag indicating whether to generate federated GraphQL model | |
15+
| graphql.federation.enabled | Boolean flag indicating whether to generate federated GraphQL model | false |
1616
| graphql.subscriptions.endpoint | GraphQL subscriptions endpoint | "subscriptions" |
1717
| 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 |
1919
| graphql.playground.endpoint | Prisma Labs Playground GraphQL IDE endpoint | "playground" |

0 commit comments

Comments
 (0)