Skip to content
This repository has been archived by the owner on Dec 19, 2023. It is now read-only.

How to register a scalar type with static newScalar()? #460

Answered by oliemansm
mxmlnglt asked this question in Q&A
Discussion options

You must be logged in to vote

@mxmlnglt
In one of your Spring @Configuration files add something like this (using your own scalar implementation of course):

  @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.

Replies: 5 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by oliemansm
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants
Converted from issue

This discussion was converted from issue #460 on December 19, 2020 19:47.