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

Unable to run spring-boot-webflux sample #428

Closed
oooplz opened this issue Jun 23, 2020 · 7 comments
Closed

Unable to run spring-boot-webflux sample #428

oooplz opened this issue Jun 23, 2020 · 7 comments
Labels
Milestone

Comments

@oooplz
Copy link

oooplz commented Jun 23, 2020

I downloaded project source that spring-boot-webflux and not modify any file.

Appear exception information as flow:

Description:

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.

graphql-java-kickstart/samples#6 (comment)

@oooplz oooplz added the bug label Jun 23, 2020
@Toerktumlare
Copy link

i have the same issue, i downgraded to version 7.0.1 and it started working then

@oooplz
Copy link
Author

oooplz commented Jul 17, 2020

i have the same issue, i downgraded to version 7.0.1 and it started working then

thank you. i will try

@phongphan
Copy link

The AutoConfiguration class doesn't seems to work well with the @componentscan. The graphql.kickstart.spring.webflux.ReactiveWebSocketSubscriptionsHandler didn't pick up by spring.

I have to add this to my configuration class.

    @Bean
    @ConditionalOnMissingBean
    ReactiveWebSocketSubscriptionsHandler reactiveWebSocketSubscriptionsHandler(ReactiveSubscriptionsProtocolFactory factory) {
        return new ReactiveWebSocketSubscriptionsHandler(factory);
    }

@phongphan
Copy link

I think adding above snippet to the GraphQLSpringWebfluxAutoConfiguration.java should work too. But I don't have enough confident that it solved the primary cause.

@phongphan
Copy link

Sorry for the comment spam. But for my case, the component scan doesn't seem to work at all.

Now my configuration class is look like this:

package test;

import graphql.kickstart.execution.GraphQLInvoker;
import graphql.kickstart.execution.GraphQLObjectMapper;
import graphql.kickstart.spring.GraphQLSpringInvocationInputFactory;
import graphql.kickstart.spring.webflux.GraphQLController;
import graphql.kickstart.spring.webflux.ReactiveSubscriptionsProtocolFactory;
import graphql.kickstart.spring.webflux.ReactiveWebSocketSubscriptionsHandler;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class MyTestConfiguration {

    @Bean
    @ConditionalOnMissingBean
    ReactiveWebSocketSubscriptionsHandler reactiveWebSocketSubscriptionsHandler(ReactiveSubscriptionsProtocolFactory factory) {
        return new ReactiveWebSocketSubscriptionsHandler(factory);
    }

    @Bean
    @ConditionalOnMissingBean
    GraphQLController graphQLController(GraphQLObjectMapper objectMapper, GraphQLInvoker graphQLInvoker, GraphQLSpringInvocationInputFactory invocationInputFactory) {
        return new GraphQLController(objectMapper, graphQLInvoker, invocationInputFactory);
    }
}

Not sure if the ConditionalOnBean added in the [d865b8c] breaks the ComponentScan.

@Mixel2142
Copy link

Hello to all. If we remove the @ConditionalOnBean ({GraphQLSchema.class}) annotation in the public class GraphQLSpringWebfluxAutoConfiguration, it works fine.

@oliemansm
Copy link
Member

Fixed by implementing graphql-java-kickstart/samples#6 (comment)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

5 participants