Reputation: 355
I have an issue with my springboot application which uses the below maven dependency for graphql:
<dependency>
<groupId>com.graphql-java-generator</groupId>
<artifactId>graphql-java-runtime</artifactId>
<version>${graphql-maven-plugin.version}</version>
</dependency>
I'm getting the below error in the logs:
Description:
Field graphQL in graphql.spring.web.servlet.components.DefaultGraphQLInvocation required a bean of type 'graphql.GraphQL' that could not be found.
The injection point has the following annotations:
- @org.springframework.beans.factory.annotation.Autowired(required=true)
Action:
Consider defining a bean of type 'graphql.GraphQL' in your configuration.
Any help will be very much appreciated.
Thanks!
Upvotes: 0
Views: 2500
Reputation: 355
So finally I found out what the problem was; 'com.graphql-java-generator' contains a spring-mvc application with it's own autowiring and components. And (to me) it looks like there is a problem in the autowiring in that there is no proper bean defined for 'graphql.GraphQL' object as it is said in the error message. So the solution was to remove that library from being included in the build:
<dependency>
<groupId>com.graphql-java-generator</groupId>
<artifactId>graphql-java-runtime</artifactId>
<version>${graphql-maven-plugin.version}</version>
<exclusions>
<exclusion>
<groupId>com.graphql-java</groupId>
<artifactId>graphql-java-spring-boot-starter-webmvc</artifactId>
</exclusion>
</exclusions>
</dependency>
hope this helps someone who uses both spring boot and graphql-java together.
Upvotes: 1