@@ -17,12 +17,10 @@ the GraphQL Java team. It aims to be the foundation for all Spring, GraphQL appl
1717Please, use our https://github.com/spring-projects/spring-graphql/issues[issue tracker]
1818to report a problem, discuss a design issue, or to request a feature.
1919
20- Please, see our
21- https://github.com/spring-projects/spring-graphql/wiki[Wiki].
20+ Check the https://github.com/spring-projects/spring-graphql/wiki[Wiki].
2221for what's new, baseline requirements, and upgrade notes, and other cross-version information.
2322
24- To get started, check the Spring GraphQL starter on https://start.spring.io.
25- The are also https://github.com/spring-projects/spring-graphql/tree/1.0.x/samples[samples] in the 1.0.x branch, which will be https://github.com/spring-projects/spring-graphql/issues/208[moved out] into a separate repository.
23+ To get started, see the <<boot-starter>> and <<samples>> sections.
2624
2725
2826
@@ -53,7 +51,7 @@ is also supported, as described in the specification.
5351
5452`GraphQlHttpHandler` can be exposed as an HTTP endpoint by declaring a `RouterFunction`
5553bean and using the `RouterFunctions` from Spring MVC or WebFlux to create the route. The
56- Boot starter does this, see the
54+ <<boot- starter>> does this, see the
5755{spring-boot-ref-docs}/web.html#web.graphql.transports.http-websocket[Web Endpoints] section for
5856details, or check `GraphQlWebMvcAutoConfiguration` or `GraphQlWebFluxAutoConfiguration`
5957it contains, for the actual config.
@@ -96,7 +94,7 @@ https://github.com/enisdenjo/graphql-ws#recipes[recipes] for client use.
9694
9795`GraphQlWebSocketHandler` can be exposed as a WebSocket endpoint by declaring a
9896`SimpleUrlHandlerMapping` bean and using it to map the handler to a URL path. By default,
99- the Boot starter does not expose a GraphQL over WebSocket endpoint, but it's easy to
97+ the <<boot- starter>> does not expose a GraphQL over WebSocket endpoint, but it's easy to
10098enable it by adding a property for the endpoint path. Please, see the
10199{spring-boot-ref-docs}/web.html#web.graphql.transports.http-websocket[Web Endpoints]
102100section for details, or check the `GraphQlWebMvcAutoConfiguration` or the
@@ -164,7 +162,7 @@ include::code:RequestErrorInterceptor[]
164162<3> Update the `ExecutionResult` with the modified errors
165163
166164Use `WebGraphQlHandler` to configure the `WebGraphQlInterceptor` chain. This is supported
167- by the Boot starter, see
165+ by the <<boot- starter>> , see
168166{spring-boot-ref-docs}/web.html#web.graphql.transports.http-websocket[Web Endpoints].
169167
170168
@@ -195,21 +193,18 @@ The main implementation, `DefaultExecutionGraphQlService`, is configured with a
195193
196194`GraphQlSource` is a contract to expose the `graphql.GraphQL` instance to use that also
197195includes a builder API to build that instance. The default builder is available via
198- `GraphQlSource.schemaResourceBuilder()`. The
199- {spring-boot-ref-docs}/web.html#web.graphql[Spring Boot starter] creates an instance of
200- this builder and further initializes it as follows:
201-
202- - Loads <<execution.graphqlsource.schema-resources, schema files>> from a configurable location.
203- - Exposes {spring-boot-ref-docs}/application-properties.html#appendix.application-properties.web[properties]
204- that apply to `GraphQlSource.Builder`.
205- - Detects <<execution.graphqlsource.runtimewiring-configurer>> beans.
206- - Detects https://www.graphql-java.com/documentation/instrumentation[Instrumentation] beans for
207- {spring-boot-ref-docs}/actuator.html#actuator.metrics.supported.spring-graphql[GraphQL metrics].
208- - Detects `DataFetcherExceptionResolver` beans for <<execution.exceptions, exception resolution>>.
209- - Detects `SubscriptionExceptionResolver` beans for <<execution.exceptions.subscription, subscription exception resolution>>.
210-
211- For further customizations, you can declare a `GraphQlSourceBuilderCustomizer` bean. For example, to
212- configure your own `ExecutionIdProvider`:
196+ `GraphQlSource.schemaResourceBuilder()`.
197+
198+ The <<boot-starter>> creates an instance of this builder and further initializes it
199+ to <<execution.graphqlsource.schema-resources, load schema files>> from a configurable location,
200+ to {spring-boot-ref-docs}/application-properties.html#appendix.application-properties.web[expose properties]
201+ to apply to `GraphQlSource.Builder`, to detect
202+ <<execution.graphqlsource.runtimewiring-configurer>> beans,
203+ https://www.graphql-java.com/documentation/instrumentation[Instrumentation] beans for
204+ {spring-boot-ref-docs}/actuator.html#actuator.metrics.supported.spring-graphql[GraphQL metrics],
205+ and `DataFetcherExceptionResolver` and `SubscriptionExceptionResolver` beans for
206+ <<execution.exceptions, exception resolution>>. For further customizations, you can also
207+ declare a `GraphQlSourceBuilderCustomizer` bean, for example:
213208
214209[source,java,indent=0,subs="verbatim,quotes"]
215210----
@@ -234,7 +229,7 @@ class GraphQlConfig {
234229parsed and merged together. That means schema files can be loaded from just about any
235230location.
236231
237- By default, the Spring Boot starter
232+ By default, the Boot starter
238233{spring-boot-ref-docs}/web.html#web.graphql.schema[looks for schema files] with extensions
239234".graphqls" or ".gqls" under the location `classpath:graphql/**`, which is typically
240235`src/main/resources/graphql`. You can also use a file system location, or any location
@@ -297,14 +292,14 @@ You can use `RuntimeWiringConfigurer` to register:
297292 <<execution.graphqlsource.default-type-resolver>> for a type.
298293 - `DataFetcher` for a field, although most applications will simply configure
299294 `AnnotatedControllerConfigurer`, which detects annotated, `DataFetcher` handler methods.
300- The Spring Boot starter adds the `AnnotatedControllerConfigurer` by default.
295+ The <<boot- starter>> adds the `AnnotatedControllerConfigurer` by default.
301296
302297NOTE: GraphQL Java, server applications use Jackson only for serialization to and from maps of data.
303298Client input is parsed into a map. Server output is assembled into a map based on the field selection set.
304299This means you can't rely on Jackson serialization/deserialization annotations.
305300Instead, you can use https://www.graphql-java.com/documentation/scalars/[custom scalar types].
306301
307- The Spring Boot starter detects beans of type `RuntimeWiringConfigurer` and
302+ The <<boot- starter>> detects beans of type `RuntimeWiringConfigurer` and
308303registers them in the `GraphQlSource.Builder`. That means in most cases, you'll' have
309304something like the following in your configuration:
310305
@@ -402,7 +397,7 @@ and handle directives. For more details, see
402397GraphQL Java documentation.
403398
404399In Spring GraphQL you can register a `SchemaDirectiveWiring` through a
405- <<execution.graphqlsource.runtimewiring-configurer>>. The Spring Boot starter detects
400+ <<execution.graphqlsource.runtimewiring-configurer>>. The <<boot- starter>> detects
406401such beans, so you might have something like:
407402
408403[source,java,indent=0,subs="verbatim,quotes"]
@@ -623,7 +618,7 @@ public class MyConfig {
623618}
624619----
625620
626- The Spring Boot starter declares a `BatchLoaderRegistry` bean that you can inject into
621+ The <<boot- starter>> declares a `BatchLoaderRegistry` bean that you can inject into
627622your configuration, as shown above, or into any component such as a controller in order
628623register batch loading functions. In turn the `BatchLoaderRegistry` is injected into
629624`DefaultExecutionGraphQlService` where it ensures `DataLoader` registrations per request.
@@ -873,8 +868,7 @@ Auto-registration detects if a given repository implements `QuerydslBinderCustom
873868transparently applies that through `QuerydslDataFetcher` builder methods.
874869
875870Auto-registration is performed through a built-in `RuntimeWiringConfigurer` that can be
876- obtained from `QuerydslDataFetcher`. The
877- {spring-boot-ref-docs}/web.html#web.graphql.data-query[Boot starter] automatically
871+ obtained from `QuerydslDataFetcher`. The <<boot-starter>> automatically
878872detects `@GraphQlRepository` beans and uses them to initialize the
879873`RuntimeWiringConfigurer` with.
880874
@@ -986,8 +980,7 @@ of the repository domain type. If needed, you can use the `typeName` attribute o
986980`@GraphQlRepository` to specify the target GraphQL type name.
987981
988982Auto-registration is performed through a built-in `RuntimeWiringConfigurer` that can be
989- obtained from `QueryByExampleDataFetcher`. The
990- {spring-boot-ref-docs}/web.html#web.graphql.data-query[Boot starter] automatically
983+ obtained from `QueryByExampleDataFetcher`. The <<boot-starter>> automatically
991984detects `@GraphQlRepository` beans and uses them to initialize the
992985`RuntimeWiringConfigurer` with.
993986
@@ -1091,7 +1084,7 @@ class, indicating its role as a data fetching component in a GraphQL application
10911084`AnnotatedControllerConfigurer` detects `@Controller` beans and registers their
10921085annotated handler methods as ``DataFetcher``s via `RuntimeWiring.Builder`. It is an
10931086implementation of `RuntimeWiringConfigurer` which can be added to `GraphQlSource.Builder`.
1094- The Spring Boot starter automatically declares `AnnotatedControllerConfigurer` as a bean
1087+ The <<boot- starter>> automatically declares `AnnotatedControllerConfigurer` as a bean
10951088and adds all `RuntimeWiringConfigurer` beans to `GraphQlSource.Builder` and that enables
10961089support for annotated ``DataFetcher``s, see the
10971090{spring-boot-ref-docs}/web.html#web.graphql.runtimewiring[GraphQL RuntimeWiring] section
@@ -1685,10 +1678,36 @@ include::includes/testing.adoc[leveloffset=+1]
16851678
16861679
16871680
1681+ [[boot-starter]]
1682+ == Boot Starter
1683+
1684+ Spring Boot provides a starter for building GraphQL applications with Spring for GraphQL.
1685+ For version information, see the
1686+ https://github.com/spring-projects/spring-graphql/wiki/Spring-for-GraphQL-Versions[Spring for GraphQL Versions] wiki page.
1687+
1688+ The easiest way to get started is via https://start.spring.io by selecting
1689+ "Spring for GraphQL" along with an underlying transport such as Spring MVC of WebFlux over
1690+ HTTP or WebSocket, or over RSocket. Refer to the
1691+ https://docs.spring.io/spring-boot/docs/current/reference/html/web.html#web.graphql[Spring for GraphQL Starter]
1692+ section in the Spring Boot reference for details on supported transports, auto-configuration related
1693+ features, and more. For testing support, see
1694+ https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#features.testing.spring-boot-applications.spring-graphql-tests[Auto-Configured GraphQL Tests].
1695+
1696+ For further reference, check the following GraphQL related:
1697+
1698+ - https://docs.spring.io/spring-boot/docs/current/reference/html/actuator.html#actuator.metrics.supported.spring-graphql[Metrics]
1699+ - https://docs.spring.io/spring-boot/docs/current/reference/html/application-properties.html#appendix.application-properties.web[Properties]
1700+ - https://docs.spring.io/spring-boot/docs/current/reference/html/auto-configuration-classes.html#appendix.auto-configuration-classes.core[Auto-Configuration Classes]
1701+
1702+
1703+
1704+
16881705[[samples]]
16891706== Samples
16901707
16911708The 1.0.x branch of this repository contains {github-10x-branch}/samples[sample applications] for various scenarios.
1709+ Those samples do not exist in the `main` branch and will be
1710+ https://github.com/spring-projects/spring-graphql/issues/208[moved out] into a separate repository.
16921711
16931712You can run those by cloning this repository and running main application classes from your IDE or by typing the following on the command line:
16941713
0 commit comments