-
I'd like to register a scalar type the correct way. Indeed I found this issue #151 which has both a link to the dedicated wiki page and a GraphQLDate example. However these classes are written the old way i.e. using the How can I use the new way by using the static method Thanks. |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments
-
Then expose the object as bean
|
Beta Was this translation helpful? Give feedback.
-
could you be more explicit? thanks. |
Beta Was this translation helpful? Give feedback.
-
After you create your new scalar object, you should make it a spring bean which will register it with graphql |
Beta Was this translation helpful? Give feedback.
-
OK... so no need to call |
Beta Was this translation helpful? Give feedback.
-
@mxmlnglt @Bean
public GraphQLScalarType longScalar() {
return GraphQLScalarType.newScalar()
.name("Long")
.description("Long type")
.coercing(new LongCoercing())
.build();
} This creates and exposes a Spring Bean which is picked up automatically by GraphQL. |
Beta Was this translation helpful? Give feedback.
@mxmlnglt
In one of your Spring
@Configuration
files add something like this (using your own scalar implementation of course):This creates and exposes a Spring Bean which is picked up automatically by GraphQL.