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
Description
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:
- Create a simple working Spring application
- Add tests using
@SpringBootTest
(aka. withwebEnvironment = WebEnvironment.MOCK
) and check that they run - Add dependency to
graphql-spring-boot-starter
andgraphql-spring-boot-starter-test
- 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")