Skip to content

Spring for GraphQL 1.3

Rossen Stoyanchev edited this page May 21, 2024 · 6 revisions

== What's New in Spring for GraphQL 1.3

=== New Features

==== Virtual Thread Support

On Java 21+, when AnnotatedControllerConfigurer is configured with an Executor, e.g. when the Spring Boot property spring.threads.virtual.enabled is set, controller methods with a blocking method signature are invoked asynchronously. Method are considered blocking if they do not return Flux, Mono or CompletableFuture, and are not a Kotlin suspending function. You can configure a blocking controller method Predicate on AnnotatedControllerConfigurer.

==== Synchronous GraphQlClient

GraphQlClient provides a common workflow for GraphQL requests over any transport including HTTP, WebSocket, and RSocket. You can now use it on a blocking stack over the synchronous RestClient, and with a synchronous API. See the reference docs for details.

==== DgsGraphQlClient

DgsGraphQlClient is a thin wrapper around any GraphQlClient that is designed to work with a DGS generated client API. See the reference docs for details. In addition Spring Initializer supports creating Spring GraphQL projects with DGS codegen enabled.

==== Apollo Federation

There is now built-in support for federation. The FederationSchemaFactory assists with configuration and detects @EntityMapping controller methods to load federated entity types. For details see the reference docs.

==== SSE (Server-Sent Events) Transport

There is now support for GraphQL subscriptions over SSE with Spring MVC and WebFlux based on the GraphQL over SSE spec. See the reference docs for details. On the client side, HttpGraphQlClient supports GraphQL subscriptions over SSE via WebClient.

==== Interface Field Mappings

There is now support for mapping schema interface fields by making repeated registrations for the same field once for every implementing object type transparently unless any already exist. This works for both @SchemaMapping and for @BatchMapping methods.

==== Schema Inspection Supports Unions and Interfaces

Schema inspection supports interfaces and unions, which may work transparently, depending on the exact naming convention, by discovering Java types that correspond to interface implementing and union member types. If necessary, there are options to customize this to help the inspection.

==== Schema Inspection Supports Arguments

Schema inspection reports mismatches between @Argument controller method parameters and field arguments declared in the schema.

== Upgrade and Migration Notes

Clone this wiki locally