I am migrating a Spring Boot application from version 2.6.6 to 3.5.0, and upgrading the JDK from 17 to 21.
Previously, I was using the graphql-kickstart dependency, but I have replaced it with the built-in Spring Boot GraphQL dependency.
There’s something I was able to do with graphql-kickstart that I can’t do with the new dependency.
Previously, I had the following setup:
file.graphqls
myFunction(dateField: String): OutputDTO
file.java
public OutputDTO myFunction(Date dateField) { ... }
After migrating Spring Boot and the GraphQL dependency, my Java code now looks like this:
@QueryMapping
public OutputDTO myFunction(@Argument Date dateField) { ... }
When running this, I get the following error:
ERROR 98421 --- [nio-8082-exec-2] s.g.e.ExceptionResolversExceptionHandler : Unresolved BindException for executionId d1ee4d2c-8c2c-3f75-0833-f925fea8e154
org.springframework.validation.BindException: org.springframework.graphql.data.GraphQlArgumentBinder$ArgumentsBindingResult: 1 errors
Field error in object 'date' on field '$': rejected value [2025-04-16T09:37:58Z]; codes [typeMismatch.date,typeMismatch]; arguments []; default message [Failed to convert argument value]
at org.springframework.graphql.data.GraphQlArgumentBinder.bind(GraphQlArgumentBinder.java:151)
...
Is there a way to fix this without having to modify all my existing code?
LocalDateTimeor possibly an instant-based alternative