getContext alternative for graphql.schema.DataFetchingEnvironment
Asked Answered
D

0

10

I'm using the graphql-java-kickstart library in Spring Boot and have some code like so:

class MyResolver implements GraphQLQueryResolver {
    public String helloWorld(DataFetchingEnvironment env) {
        // this works!!
        CustomGraphQLContext context = env.getContext();
        return "Hello world";
    } 
}

I've built the context elsewhere using the GraphQLServletContextBuilder.

The problem is that getContext is deprecated. It says to alternatively use getGraphQLContext, but it's currently null for me. How do I get it populated? If I need to override the ExecutionInput, where do I do that?

Deplore answered 28/1, 2022 at 15:53 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.