samples: Unable to run spring-boot-webflux sample
Hi,
I was trying to implement the graphql-kickstart-spring-boot-starter-webflux and kept running into the below error. I tried cloning the sample spring-boot-webflux repo, but ran into the same issue as well.
Parameter 1 of method webSocketHandlerMapping in graphql.kickstart.spring.webflux.boot.GraphQLSpringWebfluxAutoConfiguration required a bean of type 'graphql.kickstart.spring.webflux.ReactiveWebSocketSubscriptionsHandler' that could not be found.
Action:
Consider defining a bean of type 'graphql.kickstart.spring.webflux.ReactiveWebSocketSubscriptionsHandler' in your configuration.
When I then try to implement a bean of ReactiveWebSocketSubscriptionsHandler, it resolves the startup error but doesn’t start
@Bean
public ReactiveWebSocketSubscriptionsHandler reactiveWebSocketSubscriptionsHandler(ReactiveSubscriptionsProtocolFactory subscriptionProtocolFactory) {
return new ReactiveWebSocketSubscriptionsHandler(subscriptionProtocolFactory);
}
But it doesn’t start up the /graphql or /subscription endpoints.
2020-05-24 21:41:42.289 INFO 23511 --- [ main] webflux.WebfluxApplication : No active profile set, falling back to default profiles: default
2020-05-24 21:41:43.596 INFO 23511 --- [ main] o.s.b.web.embedded.netty.NettyWebServer : Netty started on port(s): 8080
2020-05-24 21:41:43.606 INFO 23511 --- [ main] webflux.WebfluxApplication : Started WebfluxApplication in 1.493 seconds (JVM running for 2.156)
Am I missing something else that isn’t documented?
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 15 (4 by maintainers)
Any updates on this?
i am trying out the webflux 7.1.0 release, and i am getting this error.
Anyone that has any workaround?
7.1.0-SNAPSHOT the same
This seems related to https://github.com/graphql-java-kickstart/graphql-spring-boot/commit/d865b8cee499685ac2e155915cff576cc424bc3c Like @Racv I’m also not seeing my /graphql endpoint. I’m defining my own
graphql.schema.GraphQLSchema
bean but the autoconfiguration report listsGraphQLSpringWebfluxAutoConfiguration
in the negative matches section:EDIT: From some further experimentation it seems like the report is slightly misleading and
GraphQLSpringWebfluxAutoConfiguration
beans are being added but the controller and othergraphql.kickstart.spring.webflux
beans are not. There may be something odd with the conditional andComponentScan
: https://stackoverflow.com/questions/38474382/componentscan-doesnt-work-in-spring-boot-autoconfiguration-classThis doc suggests that using
ComponentScan
in an autoconfiguration might simply be unsupported.Hi,
I did a fresh install of the sample and still cant run the application.
Where is the bean registered? I took a look for it in the main repository and cannot find it. https://github.com/graphql-java-kickstart/graphql-spring-boot/blob/master/graphql-kickstart-spring-boot-autoconfigure-webflux/src/main/java/graphql/kickstart/spring/webflux/boot/GraphQLSpringWebfluxAutoConfiguration.java
Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'webHandler' defined in class path resource [org/springframework/boot/autoconfigure/web/reactive/WebFluxAutoConfiguration$EnableWebFluxConfiguration.class]: Initialization of bean failed; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'webSocketHandlerMapping' defined in class path resource [graphql/kickstart/spring/webflux/boot/GraphQLSpringWebfluxAutoConfiguration.class]: Unsatisfied dependency expressed through method 'webSocketHandlerMapping' parameter 1; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'graphql.kickstart.spring.webflux.ReactiveWebSocketSubscriptionsHandler' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {}