Reactor DataFetcher support
Closes gh-47
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import org.springframework.boot.gradle.plugin.SpringBootPlugin
|
||||
|
||||
plugins {
|
||||
id 'org.springframework.boot' version '2.4.4' apply false
|
||||
id 'org.springframework.boot' version '2.4.5' apply false
|
||||
id 'io.spring.dependency-management' version '1.0.10.RELEASE'
|
||||
id 'java-library'
|
||||
id 'maven'
|
||||
@@ -24,6 +24,7 @@ dependencyManagement {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
api project(':spring-graphql-core')
|
||||
api project(':spring-graphql-web')
|
||||
api 'com.graphql-java:graphql-java:16.2'
|
||||
api 'io.projectreactor:reactor-core'
|
||||
|
||||
@@ -23,6 +23,7 @@ import graphql.GraphQL;
|
||||
import graphql.execution.instrumentation.ChainedInstrumentation;
|
||||
import graphql.execution.instrumentation.Instrumentation;
|
||||
import graphql.schema.GraphQLSchema;
|
||||
import graphql.schema.SchemaTransformer;
|
||||
import graphql.schema.idl.RuntimeWiring;
|
||||
import graphql.schema.idl.SchemaGenerator;
|
||||
import graphql.schema.idl.SchemaParser;
|
||||
@@ -36,6 +37,7 @@ import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.core.io.Resource;
|
||||
import org.springframework.core.io.ResourceLoader;
|
||||
import org.springframework.graphql.core.ReactorDataFetcherAdapter;
|
||||
|
||||
@Configuration
|
||||
@ConditionalOnClass(GraphQL.class)
|
||||
@@ -71,8 +73,11 @@ public class GraphQLAutoConfiguration {
|
||||
public GraphQL.Builder graphQLBuilder(GraphQLProperties properties, RuntimeWiring runtimeWiring,
|
||||
ResourceLoader resourceLoader,
|
||||
ObjectProvider<Instrumentation> instrumentationsProvider) {
|
||||
|
||||
Resource schemaResource = resourceLoader.getResource(properties.getSchemaLocation());
|
||||
GraphQLSchema schema = buildSchema(schemaResource, runtimeWiring);
|
||||
schema = SchemaTransformer.transformSchema(schema, ReactorDataFetcherAdapter.TYPE_VISITOR);
|
||||
|
||||
GraphQL.Builder builder = GraphQL.newGraphQL(schema);
|
||||
List<Instrumentation> instrumentations = instrumentationsProvider.orderedStream().collect(Collectors.toList());
|
||||
if (!instrumentations.isEmpty()) {
|
||||
|
||||
Reference in New Issue
Block a user