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

GraphQLTestAutoConfiguration tries to autowire TestRestTemplate regardless of WebEnvironmentย #544

Closed
@lassemaatta

Description

@lassemaatta

Describe the bug
When the GraphQLTestAutoConfiguration class attempts to initialize the graphQLTestUtils bean, a NoSuchBeanDefinitionException is thrown because TestRestTemplate could not be autowired.

To Reproduce
Steps to reproduce the behavior:

  1. Create a simple working Spring application
  2. Add tests using @SpringBootTest (aka. with webEnvironment = WebEnvironment.MOCK) and check that they run
  3. Add dependency to graphql-spring-boot-starter and graphql-spring-boot-starter-test
  4. Notice how existing tests now fail to start due to NoSuchBeanDefinitionException

Expected behavior
Adding the graphql dependencies should not break existing tests.

Additional context
A workaround is to explicitly disable graphql for the existing tests, using eg. @SpringBootTest(properties = "graphql.servlet.enabled=false")

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions