Skip to content

Commit

Permalink
iRemove TypeDefinitionConfigurer auto-configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
bclozel committed Feb 16, 2024
1 parent 77922af commit 4fd0e29
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@
import org.springframework.graphql.execution.GraphQlSource;
import org.springframework.graphql.execution.RuntimeWiringConfigurer;
import org.springframework.graphql.execution.SubscriptionExceptionResolver;
import org.springframework.graphql.execution.TypeDefinitionConfigurer;

/**
* {@link EnableAutoConfiguration Auto-configuration} for creating a Spring GraphQL base
Expand Down Expand Up @@ -96,8 +95,7 @@ public GraphQlSource graphQlSource(ResourcePatternResolver resourcePatternResolv
ObjectProvider<DataFetcherExceptionResolver> exceptionResolvers,
ObjectProvider<SubscriptionExceptionResolver> subscriptionExceptionResolvers,
ObjectProvider<Instrumentation> instrumentations, ObjectProvider<RuntimeWiringConfigurer> wiringConfigurers,
ObjectProvider<GraphQlSourceBuilderCustomizer> sourceCustomizers,
ObjectProvider<TypeDefinitionConfigurer> typeDefinitionConfigurers) {
ObjectProvider<GraphQlSourceBuilderCustomizer> sourceCustomizers) {
String[] schemaLocations = properties.getSchema().getLocations();
Resource[] schemaResources = resolveSchemaResources(resourcePatternResolver, schemaLocations,
properties.getSchema().getFileExtensions());
Expand All @@ -112,7 +110,6 @@ public GraphQlSource graphQlSource(ResourcePatternResolver resourcePatternResolv
if (!properties.getSchema().getIntrospection().isEnabled()) {
builder.configureRuntimeWiring(this::enableIntrospection);
}
typeDefinitionConfigurers.forEach(builder::configureTypeDefinitions);
builder.configureTypeDefinitions(new ConnectionTypeDefinitionConfigurer());
wiringConfigurers.orderedStream().forEach(builder::configureRuntimeWiring);
sourceCustomizers.orderedStream().forEach((customizer) -> customizer.customize(builder));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
import graphql.schema.GraphQLOutputType;
import graphql.schema.GraphQLSchema;
import graphql.schema.idl.RuntimeWiring;
import graphql.schema.idl.TypeDefinitionRegistry;
import graphql.schema.visibility.DefaultGraphqlFieldVisibility;
import graphql.schema.visibility.NoIntrospectionGraphqlFieldVisibility;
import org.assertj.core.api.InstanceOfAssertFactories;
Expand All @@ -53,7 +52,6 @@
import org.springframework.graphql.execution.DataLoaderRegistrar;
import org.springframework.graphql.execution.GraphQlSource;
import org.springframework.graphql.execution.RuntimeWiringConfigurer;
import org.springframework.graphql.execution.TypeDefinitionConfigurer;

import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.mock;
Expand Down Expand Up @@ -224,14 +222,6 @@ void shouldContributeConnectionTypeDefinitionConfigurer() {
});
}

@Test
void shouldUseCustomTypeDefinitionConfigurerWhenDefined() {
this.contextRunner.withUserConfiguration(CustomTypeDefinitionConfigurer.class).run((context) -> {
TestTypeDefinitionConfigurer configurer = context.getBean(TestTypeDefinitionConfigurer.class);
assertThat(configurer.applied).isTrue();
});
}

@Test
void whenApplicationTaskExecutorIsDefinedThenAnnotatedControllerConfigurerShouldUseIt() {
this.contextRunner.withConfiguration(AutoConfigurations.of(TaskExecutionAutoConfiguration.class))
Expand Down Expand Up @@ -347,25 +337,4 @@ Executor customExecutor() {

}

@Configuration(proxyBeanMethods = false)
static class CustomTypeDefinitionConfigurer {

@Bean
TestTypeDefinitionConfigurer testTypeDefinitionConfigurer() {
return new TestTypeDefinitionConfigurer();
}

}

static class TestTypeDefinitionConfigurer implements TypeDefinitionConfigurer {

boolean applied = false;

@Override
public void configure(TypeDefinitionRegistry registry) {
this.applied = true;
}

}

}

0 comments on commit 4fd0e29

Please sign in to comment.