Search in sources :

Example 1 with DefaultBatchLoaderRegistry

use of org.springframework.graphql.execution.DefaultBatchLoaderRegistry in project spring-graphql by spring-projects.

the class BatchMappingTestSupport method createGraphQlService.

protected GraphQlService createGraphQlService(CourseController controller) {
    BatchLoaderRegistry registry = new DefaultBatchLoaderRegistry();
    AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
    context.registerBean(CourseController.class, () -> controller);
    context.registerBean(BatchLoaderRegistry.class, () -> registry);
    context.refresh();
    return GraphQlSetup.schemaContent(schema).runtimeWiringForAnnotatedControllers(context).dataLoaders(registry).toGraphQlService();
}
Also used : AnnotationConfigApplicationContext(org.springframework.context.annotation.AnnotationConfigApplicationContext) BatchLoaderRegistry(org.springframework.graphql.execution.BatchLoaderRegistry) DefaultBatchLoaderRegistry(org.springframework.graphql.execution.DefaultBatchLoaderRegistry) DefaultBatchLoaderRegistry(org.springframework.graphql.execution.DefaultBatchLoaderRegistry)

Example 2 with DefaultBatchLoaderRegistry

use of org.springframework.graphql.execution.DefaultBatchLoaderRegistry in project spring-graphql by spring-projects.

the class SchemaMappingInvocationTests method graphQlService.

private GraphQlService graphQlService() {
    BatchLoaderRegistry registry = new DefaultBatchLoaderRegistry();
    AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
    context.register(BookController.class);
    context.registerBean(BatchLoaderRegistry.class, () -> registry);
    context.refresh();
    return GraphQlSetup.schemaResource(BookSource.schema).runtimeWiringForAnnotatedControllers(context).dataLoaders(registry).toGraphQlService();
}
Also used : AnnotationConfigApplicationContext(org.springframework.context.annotation.AnnotationConfigApplicationContext) BatchLoaderRegistry(org.springframework.graphql.execution.BatchLoaderRegistry) DefaultBatchLoaderRegistry(org.springframework.graphql.execution.DefaultBatchLoaderRegistry) DefaultBatchLoaderRegistry(org.springframework.graphql.execution.DefaultBatchLoaderRegistry)

Aggregations

AnnotationConfigApplicationContext (org.springframework.context.annotation.AnnotationConfigApplicationContext)2 BatchLoaderRegistry (org.springframework.graphql.execution.BatchLoaderRegistry)2 DefaultBatchLoaderRegistry (org.springframework.graphql.execution.DefaultBatchLoaderRegistry)2