-
Notifications
You must be signed in to change notification settings - Fork 319
Spring for GraphQL 2.0
This is a preview of the Spring for GraphQL 2.0 release, scheduled for November 2025.
Spring for GraphQL 2.0 now requires Spring Framework 7.0 and its baseline.
Spring for GraphQL now requires graphql-java 24.0, but we are still tracking the upcoming 25.0 as a potential baseline for this generation. The 25.0 version is likely to bring interesting features, including a complete support for request cancellation in the core engine.
We are following the lead of Spring Framework, as we've upgraded to Kotlin 2.2.0. Similarly, spring-graphql now picks Jackson 3.x as the default but still supports Jackson 2.x as a fallback option. If you are upgrading your project, check out this section on major changes for this Jackson upgrade.
We have applied the JSpecify annotations to its entire public API.
This should now help IDEs provide you with consistent warnings, avoiding NullPointerExceptions
in production when using Spring for GraphQL.
If you are using Kotlin 2.1+, such annotations are directly baked in Kotlin types and used at compile time. Nullability checks on the spring-graphql codebase are performed automatically at build time. Please share your upgrade experience with us!
This first milestone ships a few new features requested by the community.
Did you ever encounter type attributes in your GraphQL schema with a syntax that's not compatible with Java field names, or not aligned with your code style? For example, an input type like:
input CreateProjectInput {
id: ID!
project_slug: String
}
GraphQlArgumentBinder
now has options for allowing mapping GraphQL arguments to Object property names.
Yau can provide a custom function that will adapt the schema name to a style of your choosing.
// configure binding options for GraphQL
var options = GraphQlArgumentBinder.Options.create()
.nameResolver(name -> toCamelCase(name));
You can then set those options on AnnotatedControllerConfigurer#setBinderOptions
.
By default, input types in GraphQL are nullable and optional.
An input value (or any of its fields) can be set to the null
literal, or not provided at all.
This distinction is useful for partial updates with a mutation where the underlying data may also be, either set to null or not changed at all accordingly.
On the client side, we could not express this properly for *Input
types as Java does not have this present/null/ommitted concept.
We now support the ArgumentValue<T>
type on input types when serializing request variables.
This is supported thanks to a Jackson module and documented in "Optional input" section.
The DGS GraphQL client allows sending multiple queries in a single request with a dedicated contract.
This is now possible with the DgsGraphQlClient
, since you can chain multiple request()
calls for a single request exchange.
See the reference documentation for more.