graphql-maven-plugin-project: Scalar implementations are not found, when migrating to 2.x Version
During a migration from Spring Boot 2 to 3, I am currently upgrading from version 1.18.9 to 2.4. All files could be compiled and code generation works. When i am starting the application, I get this exception:
Caused by: graphql.schema.idl.errors.SchemaProblem: errors=[There is no scalar implementation for the named 'AlertManagementHttpIntegrationID' scalar type, There is no scalar implementation for the named 'AwardableID' scalar type, There is no...,]
at graphql.schema.idl.SchemaGenerator.makeExecutableSchema(SchemaGenerator.java:81) ~[graphql-java-20.4.jar:na]
at graphql.schema.idl.SchemaGenerator.makeExecutableSchema(SchemaGenerator.java:57) ~[graphql-java-20.4.jar:na]
at org.springframework.graphql.execution.DefaultSchemaResourceGraphQlSourceBuilder.initGraphQlSchema(DefaultSchemaResourceGraphQlSourceBuilder.java:162) ~[spring-graphql-1.2.6.jar:1.2.6]
at org.springframework.graphql.execution.AbstractGraphQlSourceBuilder.build(AbstractGraphQlSourceBuilder.java:105) ~[spring-graphql-1.2.6.jar:1.2.6]
at org.springframework.boot.autoconfigure.graphql.GraphQlAutoConfiguration.graphQlSource(GraphQlAutoConfiguration.java:115) ~[spring-boot-autoconfigure-3.2.6.jar:3.2.6]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[na:na]
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
at java.base/java.lang.reflect.Method.invoke(Method.java:568) ~[na:na]
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:140) ~[spring-beans-6.1.8.jar:6.1.8]
... 87 common frames omitted
I added all customScalars to the gradle file…
customScalars =
[
[
graphQLTypeName : "AlertManagementHttpIntegrationID",
javaType : "java.lang.String",
graphQLScalarTypeStaticField: "graphql.Scalars.GraphQLString"
],
[
graphQLTypeName : "AwardableID",
javaType : "java.lang.String",
graphQLScalarTypeStaticField: "graphql.Scalars.GraphQLString"
],
...
]
I have rigorus followed your migration guide and made all changes you mentioned. To help you understand the error, I have created a branch that includes the migration to Spring 3 and uses the corresponding dependencies. You can check out the Project here: graphgl-generator-example. You see that everthing works on master branch with the old version including the tests (simply use gradle build -x test and then ./gradlew bootRun). But when u switch from the branch ‘master’ to the ‘migration-to-spring3’ branch u get the errors shown above.
I hope you can help. Thanks in advance.
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 17
Commits related to this issue
- Issue #213:err when custom scalar's name differs from GraphQLType's name — committed to graphql-java-generator/graphql-maven-plugin-project by deleted user 2 years ago
- Issue #213: err with spring autoconfiguration beans creation — committed to graphql-java-generator/graphql-maven-plugin-project by deleted user 2 years ago
I released the 2.7 version. Please confirm that it’s ok for you
Hello,
You encountered two different issues, there !
MyDatescalar definition would not work with the GraphQL extended scalarDategraphQlSource, which is not used by the plugin. So it was not configured by it. I added the needed bean so that thegraphQlSourceis properly createdSo there is no more error in the build, or when your
Applicationclass starts.How can I check that it works also during the server execution?
Etienne
Hello, right, I was on the master branch.
So I can repeat the issue. I still need some work to correct it.
Étienne