Better documentation when it comes to webflux and spring boot #435
Description
Is your feature request related to a problem? Please describe.
I am an intermediate java developer that spent 3 hours reading about graphql, i am at the moment developing a webflux application and i though about implementing graphql in my webflux application. I try first to find a webflux implementation which is hard enough and when i find one here, sadly there is no documentation about it.
In my googling i found a feature request for a webflux implementation and that brought me to the kickstart project, it was implemented in november last year, and that issue links to a sample project:
Webflux sample
I also found another webflux project under examples:
example-webflux
No documentation found about these projects or on the kickstarter page whatsoever about webflux, only servlet and spring boot, but not explicitly about webflux in the spring boot section. Both semple/example projects implement 2 dependencies in their gradle files:
graphql-kickstart-spring-boot-starter-webflux
graphql-kickstart-spring-boot-starter-tools
The first dependency i understand, the second one, no documentation why it is needed. I do find that in order to use the graphQL DSL you need the "GraphQL Java Tools" could the second dependency be that? i have no idea, since there is no documentation. Digging into the pom.xml
i do find that the second dependency is dragging in graphql-kickstart-spring-boot-autoconfigure-tools
that in turn is dragging in the graphql-java-tools
so yes.
When booting up the spring boot application won't start.
Description:
Parameter 0 of method graphQLSchemaProvider in graphql.kickstart.spring.webflux.boot.GraphQLSpringWebfluxAutoConfiguration required a bean of type 'graphql.schema.GraphQLSchema' that could not be found.
The following candidates were found but could not be injected:
- Bean method 'graphQLSchema' in 'GraphQLJavaToolsAutoConfiguration' not loaded because @ConditionalOnBean (types: graphql.kickstart.tools.SchemaParser; SearchStrategy: all) did not find any beans of type graphql.kickstart.tools.SchemaParser
Action:
Consider revisiting the entries above or defining a bean of type 'graphql.schema.GraphQLSchema' in your configuration.
Disconnected from the target VM, address: '127.0.0.1:60904', transport: 'socket'
Process finished with exit code 1
It needs some sort of bean, but there is no documentation about what bean, and the purpose of the bean, or how to declare it etc.
in the sample application, no bean is declared, only schema files, i spend some time digging but can't figure out how the sample project works because no bean is declared there.
in the example project there is a bean declared:
@Bean
GraphQLSchema schema() {
return GraphQLSchema.newSchema()
.query(GraphQLObjectType.newObject()
.name("query")
.field(field -> field
.name("test")
.type(Scalars.GraphQLString)
.dataFetcher(environment -> "response")
)
.build())
.build();
}
But there is no declaration as to what this bean is, it looks like it is declaring a schema. There is no documentation about this bean on the kickstarted spring boot webpage either, i actually can't find a single word about the GraphQLSchema
object in the entire documentation.
Describe the solution you'd like
I wish there to be more user friendly documentation as to how to get started from scratch. Since there is a lot of question marks in to how to get started, or i'm just stupid. And if that is so i apologize because that could be also be a fact.
I'd gladly write some more documentation and submit a PR to the documentation repo, as soon as i start getting things.