You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Dec 19, 2023. It is now read-only.
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. with webEnvironment = WebEnvironment.MOCK) and check that they run
Add dependency to graphql-spring-boot-starter and graphql-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")
The text was updated successfully, but these errors were encountered:
I have this exact same issue, however your workaround doesn't work for me as I get another error:
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'graphQLWebsocketServlet' defined in class path resource [graphql/kickstart/spring/web/boot/GraphQLWebsocketAutoConfiguration.class]: Unsatisfied dependency expressed through method 'graphQLWebsocketServlet' parameter 0; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'graphql.kickstart.execution.subscriptions.GraphQLSubscriptionInvocationInputFactory' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {}
+1
Issue might be also be caused by @ConditionalOnProperty(value = "graphql.servlet.enabled", havingValue = "true", matchIfMissing = true)
Slightly nicer approach for now is to disable auto config in general configuration file: @EnableAutoConfiguration(exclude = {GraphQLTestAutoConfiguration.class})
After that you could create local config with GraphQL enabled
with com.graphql-java-kickstart.graphiql-spring-boot-starter:11.0.0 and com.graphql-java-kickstart.graphql-spring-boot-starter-test:11.0.0 we only need to add @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
Voila it works as expected. We can have something else done either. Not sure why the above just work without the property change.
Describe the bug
When the
GraphQLTestAutoConfiguration
class attempts to initialize thegraphQLTestUtils
bean, aNoSuchBeanDefinitionException
is thrown becauseTestRestTemplate
could not be autowired.To Reproduce
Steps to reproduce the behavior:
@SpringBootTest
(aka. withwebEnvironment = WebEnvironment.MOCK
) and check that they rungraphql-spring-boot-starter
andgraphql-spring-boot-starter-test
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")
The text was updated successfully, but these errors were encountered: