Spring for GraphQL 1.3 M1 Released

Releases | Rossen Stoyanchev | February 21, 2024 | ...

On behalf of the Spring for GraphQL team, I am pleased to announce the availability of our first 1.3 milestone. The release includes a number of new features described in this post.

Synchronous GraphQlClient

GraphQlClient provides a common workflow for GraphQL requests over any transport including HTTP, WebSocket, and RSocket. Following the availability of Project Loom in Java 21, and a new synchronous RestClient in Spring Framework 6.1, we've now added the option to use GraphQlClient on a blocking stack, and to use a synchronous API. See the reference docs for details on how to create GraphQlClient with a RestClient-based transport.

GraphQlClient continues to be a common API over blocking and non-blocking transports, now also offering a choice of synchronous vs asynchronous usage. This means at build time you choose whether to run on blocking or non-blocking transport, and at runtime you retain the choice to perform requests synchronously or asynchronously.


To perform GraphQL requests, you need to provide the GraphQL operation as text, a String literal or loaded from a document file. Alternatively, DGS Codegen can generate a Java client API to define requests. We've now added a new DgsGraphQlClient that makes it easy to use DGS code generated classes.

DgsGraphQlClient is a thin wrapper around any GraphQlClient. It provides a dedicated workflow to define the request, but otherwise uses GraphQlClient to perform requests, and exposes the same API to handle the response.

See reference docs for details. In addition Spring Initializer supports creating Spring GraphQL projects with DGS codegen enabled.

SSE Support

We now provide support for handling GraphQL subscription requests 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 now supports GraphQL subscriptions over SSE.

Apollo Federation

When a federated GraphQL service starts, it needs to initialize the GraphQLSchema through the federation-jvm library to add support for federation directives, and to handle requests for federated entities types.

We now provide FederationSchemaFactory to perform this configuration step. The factory detects @EntityMapping controller methods that you can use to load federated entity types. Such methods can use @Argument annotated method parameters to access entity id values with type conversion. They can execute synchronously or asynchronously. They can also have exceptions resolved via @GraphQlExceptionHandler methods resolved to GraphQLErrors.

For details see the reference docs.


Last but not least, we have collaborated with the DGS team on a common foundation for Spring GraphQL applications. You can read a summary of the effort. As a result there is a new integration in the DGS Framework that's being finalized, and there have been a number of important updates in the Spring for GraphQL 1.2.5 release that enable the integration, for the benefit of all Spring for GraphQL applications. We thank the DGS team and look forward to our continued collaboration!

Please, give the 1.3 M1 release a try via https://repo.spring.io/milestone, and provide us with feedback at our issue tracker!

Get the Spring newsletter

Thank you for your interest. Someone will get back to you shortly.

Get ahead

VMware offers training and certification to turbo-charge your progress.

Learn more

Get support

Tanzu Spring Runtime offers support and binaries for OpenJDK™, Spring, and Apache Tomcat® in one simple subscription.

Learn more

Upcoming events

Check out all the upcoming events in the Spring community.

View all