Description
As of spring-projects/spring-graphql#10, Spring GraphQL ships a GraphQlClient
; this brings a new use case for the Spring GraphQL starter: building an application that consumes a remote GraphQL API but does not expose one.
Right now the GraphQlAutoConfiguration
is only conditional on the presence of spring-graphql. With that, an application that just want to use the client will fail at startup, since we're trying to find graphql schema files on the configured classpath locations and fail if none was found. This is by design as a schema-less GraphQL API is invalid.
We should refine the GraphQlAutoConfiguration
and add a custom condition that triggers the auto-configuration only if:
- we detect schema files in the configured locations
- OR we detect
GraphQlSourceBuilderCustomizer
as those can contribute to the schema
So far it doesn't seem we need extra auto-configuration for the client use case, as Spring Boot already contributes a WebClient.Builder
and other opinions cannot be inferred from the application environment.