Skip to content

Commit c27bb77

Browse files
committed
Merge branch '3.1.x' into 3.2.x
2 parents 00edc66 + 7eb155d commit c27bb77

File tree

2 files changed

+6
-12
lines changed

2 files changed

+6
-12
lines changed

spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/graphql/GraphQlAutoConfiguration.java

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2023 the original author or authors.
2+
* Copyright 2012-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -25,8 +25,7 @@
2525

2626
import graphql.GraphQL;
2727
import graphql.execution.instrumentation.Instrumentation;
28-
import graphql.schema.idl.RuntimeWiring.Builder;
29-
import graphql.schema.visibility.NoIntrospectionGraphqlFieldVisibility;
28+
import graphql.introspection.Introspection;
3029
import org.apache.commons.logging.Log;
3130
import org.apache.commons.logging.LogFactory;
3231

@@ -108,18 +107,14 @@ public GraphQlSource graphQlSource(ResourcePatternResolver resourcePatternResolv
108107
builder.inspectSchemaMappings(logger::info);
109108
}
110109
if (!properties.getSchema().getIntrospection().isEnabled()) {
111-
builder.configureRuntimeWiring(this::enableIntrospection);
110+
Introspection.enabledJvmWide(false);
112111
}
113112
builder.configureTypeDefinitions(new ConnectionTypeDefinitionConfigurer());
114113
wiringConfigurers.orderedStream().forEach(builder::configureRuntimeWiring);
115114
sourceCustomizers.orderedStream().forEach((customizer) -> customizer.customize(builder));
116115
return builder.build();
117116
}
118117

119-
private Builder enableIntrospection(Builder wiring) {
120-
return wiring.fieldVisibility(NoIntrospectionGraphqlFieldVisibility.NO_INTROSPECTION_FIELD_VISIBILITY);
121-
}
122-
123118
private Resource[] resolveSchemaResources(ResourcePatternResolver resolver, String[] locations,
124119
String[] extensions) {
125120
List<Resource> resources = new ArrayList<>();

spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/graphql/GraphQlAutoConfigurationTests.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2023 the original author or authors.
2+
* Copyright 2012-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -22,12 +22,12 @@
2222
import graphql.GraphQL;
2323
import graphql.execution.instrumentation.ChainedInstrumentation;
2424
import graphql.execution.instrumentation.Instrumentation;
25+
import graphql.introspection.Introspection;
2526
import graphql.schema.GraphQLObjectType;
2627
import graphql.schema.GraphQLOutputType;
2728
import graphql.schema.GraphQLSchema;
2829
import graphql.schema.idl.RuntimeWiring;
2930
import graphql.schema.visibility.DefaultGraphqlFieldVisibility;
30-
import graphql.schema.visibility.NoIntrospectionGraphqlFieldVisibility;
3131
import org.assertj.core.api.InstanceOfAssertFactories;
3232
import org.junit.jupiter.api.Test;
3333
import org.junit.jupiter.api.extension.ExtendWith;
@@ -181,8 +181,7 @@ void shouldDisableFieldIntrospection() {
181181
this.contextRunner.withPropertyValues("spring.graphql.schema.introspection.enabled:false").run((context) -> {
182182
GraphQlSource graphQlSource = context.getBean(GraphQlSource.class);
183183
GraphQLSchema schema = graphQlSource.schema();
184-
assertThat(schema.getCodeRegistry().getFieldVisibility())
185-
.isInstanceOf(NoIntrospectionGraphqlFieldVisibility.class);
184+
assertThat(Introspection.isEnabledJvmWide()).isFalse();
186185
});
187186
}
188187

0 commit comments

Comments
 (0)