'Spring GraphQL projection throws no bean resolver exception

I have a Spring Boot application with Spring for GraphQL library and I need to modify the returned object. So I created and registered a projection class referring to my bean method:

public interface MyEntityProjection {

    @Value("#{@myBean.getName()}")
    public String getName();
}

But this results in org.springframework.expression.spel.SpelEvaluationException: EL1057E: No bean resolver registered in the context to resolve access to bean 'myBean' when the query is run. Probably a bean resolver needs to be registered somehow but there is no info in the documentation https://docs.spring.io/spring-graphql/docs/1.0.0-SNAPSHOT/reference/html/

Simple application illustrating my problem: https://github.com/omichal/spring-graphq-no-bean-resolver



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source