|
|
@ -38,6 +38,7 @@ import org.springframework.graphql.GraphQlService;
|
|
|
|
import org.springframework.graphql.data.method.annotation.support.AnnotatedControllerConfigurer;
|
|
|
|
import org.springframework.graphql.data.method.annotation.support.AnnotatedControllerConfigurer;
|
|
|
|
import org.springframework.graphql.execution.BatchLoaderRegistry;
|
|
|
|
import org.springframework.graphql.execution.BatchLoaderRegistry;
|
|
|
|
import org.springframework.graphql.execution.DataFetcherExceptionResolver;
|
|
|
|
import org.springframework.graphql.execution.DataFetcherExceptionResolver;
|
|
|
|
|
|
|
|
import org.springframework.graphql.execution.DataLoaderRegistrar;
|
|
|
|
import org.springframework.graphql.execution.GraphQlSource;
|
|
|
|
import org.springframework.graphql.execution.GraphQlSource;
|
|
|
|
import org.springframework.graphql.execution.MissingSchemaException;
|
|
|
|
import org.springframework.graphql.execution.MissingSchemaException;
|
|
|
|
import org.springframework.graphql.execution.RuntimeWiringConfigurer;
|
|
|
|
import org.springframework.graphql.execution.RuntimeWiringConfigurer;
|
|
|
@ -169,6 +170,21 @@ class GraphQlAutoConfigurationTests {
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
|
|
|
void shouldConfigureCustomBatchLoaderRegistry() {
|
|
|
|
|
|
|
|
this.contextRunner
|
|
|
|
|
|
|
|
.withBean("customBatchLoaderRegistry", BatchLoaderRegistry.class, () -> mock(BatchLoaderRegistry.class))
|
|
|
|
|
|
|
|
.run((context) -> {
|
|
|
|
|
|
|
|
assertThat(context).hasSingleBean(BatchLoaderRegistry.class);
|
|
|
|
|
|
|
|
assertThat(context.getBean("customBatchLoaderRegistry"))
|
|
|
|
|
|
|
|
.isSameAs(context.getBean(BatchLoaderRegistry.class));
|
|
|
|
|
|
|
|
assertThat(context.getBean(GraphQlService.class))
|
|
|
|
|
|
|
|
.extracting("dataLoaderRegistrars",
|
|
|
|
|
|
|
|
InstanceOfAssertFactories.list(DataLoaderRegistrar.class))
|
|
|
|
|
|
|
|
.containsOnly(context.getBean(BatchLoaderRegistry.class));
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Configuration(proxyBeanMethods = false)
|
|
|
|
@Configuration(proxyBeanMethods = false)
|
|
|
|
static class CustomGraphQlBuilderConfiguration {
|
|
|
|
static class CustomGraphQlBuilderConfiguration {
|
|
|
|
|
|
|
|
|
|
|
|