'Graphql java spring boot -- Scalar type error -- There is no scalar implementation for the named 'XXX' scalar type
I want to make scalar type it will report an error Even I use extended-scalars, It did not work at all.
- Version:
spring-boot: 2.7.0
<dependency>
<groupId>com.graphql-java-kickstart</groupId>
<artifactId>graphql-spring-boot-starter</artifactId>
<version>12.0.0</version>
</dependency>
<dependency>
<groupId>com.graphql-java-kickstart</groupId>
<artifactId>graphql-java-tools</artifactId>
<version>12.0.0</version>
</dependency>
<dependency>
<groupId>com.graphql-java</groupId>
<artifactId>graphiql-spring-boot-starter</artifactId>
<version>5.0.2</version>
</dependency>
- Code
@Configuration
public class Conf {
@Bean
public GraphQLScalarType graphQLLong() {
return ExtendedScalars.GraphQLLong;
}
}
Caused by: SchemaProblem{errors=[There is no scalar implementation for the named 'Long' scalar type]}
- Schema structure (a very simple one)
scalar Long
type Mutation {
}
- yml config
Solution 1:[1]
Include graphql-java-extended-scalars dependency:
https://github.com/graphql-java/graphql-java-extended-scalars
And make sure in your @Configuration class you are using:
@Bean
public graphql.schema.GraphQLScalarType extendedScalarLong() {
return graphql.scalars.ExtendedScalars.GraphQLLong;
}
Also, if you are defining your ExtendedScalar as a @Bean, then there's no need to specify it in graphql.extended-scalars property.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Bogdan Kobylynskyi |


