Skip to content
This repository was archived by the owner on Dec 19, 2023. It is now read-only.
This repository was archived by the owner on Dec 19, 2023. It is now read-only.

No qualifying bean of type 'com.graphql.spring.boot.test.GraphQLTestTemplate' available : graphql-spring-boot-starter-test:jar:15.0.0 #978

@himanshs

Description

@himanshs

Hi,

we are upgrading our project to spring boot 3 and as part of that we have upgraded graphql-spring-boot to 15.0.0. After this upgraded we are getting issue for GraphQlTestTemplate in Junit.

@graphqltest
@ContextConfiguration(classes = {TestConfig.class, MessagesConfig.class})
@RunWith(SpringRunner.class)
public class QueryTest {

@Autowired
private GraphQLTestTemplate graphQLTestTemplate;

@MockBean
private TicketTicketentityServiceApiMock ticketTicketentityServiceApiMock;

@Inject
private GraphqlUtils graphqlUtils;

@Autowired
private IHeadersAccessor headersAccessor;

@Autowired
@Qualifier("asyncExecutor")
public AsyncTaskExecutor executor;

@Test
public void searchTickets() throws IOException {
    GraphQLResponse response = graphQLTestTemplate.postForResource(TestConstants.SEARCH_TICKET_QUERY_FILE);
    String str = getStringFromJson(TestConstants.SEARCH_TICKET_GRAPH_RES);
    assertNotNull(response);
    assertTrue(response.isOk());
    assertEquals(str, response.getRawResponse().getBody());
}

}

Below stack trace of the exception.

Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.graphql.spring.boot.test.GraphQLTestTemplate' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
at org.springframework.beans.factory.support.DefaultListableBeanFactory.raiseNoMatchingBeanFound(DefaultListableBeanFactory.java:1824)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1383)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1337)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.resolveFieldValue(AutowiredAnnotationBeanPostProcessor.java:713)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions