본문 바로가기
Kotlin Spring

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'schema' defined in class path resource [com/expediagroup/graphql/server/spring/NonFederatedSchemaAutoConfiguration.class]: Failed to instantiate [graphql.schema.GraphQ

by Bill Lab 2024. 11. 28.
728x90

제목과 같은 오류 

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'schema' defined in class path resource [com/expediagroup/graphql/server/spring/NonFederatedSchemaAutoConfiguration.class]: Failed to instantiate [graphql.schema.GraphQLSchema]: Factory method 'schema' threw exception with message: Invalid query object type - no valid queries are available.

 

가 뜬다면!!?!?!

 

걱정하지말자(아마, graphql 을 처음사용하거나, expediagroup 에서 제공하는 graphql 을 처음사용해보는 경우가 대부분일 것이다.

해결방법은 간단!

 

여러분이 개발한 resolve(mutation, query) 단의 class 전영역에 반환타입을 Query or Mutation 을 지정하면 된다.

<예시코드>

@Component
class TestQuery(
    private val testService: TestService
): Query {

   ~~~
   


@Component
class TestMutation (
    private val testService: TestService
): Mutation {

    ~~~~
728x90