getContext alternative for graphql.schema.DataFetchingEnvironment

Viewed 398

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?

0 Answers
Related