Skip to content

Commit d137f92

Browse files
committed
Adapt to latest Spring for GraphQL changes
This commit adapts to changes done in spring-projects/spring-graphql#312
1 parent ec31cb2 commit d137f92

File tree

5 files changed

+17
-14
lines changed

5 files changed

+17
-14
lines changed

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,9 @@ public GraphQlSource graphQlSource(ResourcePatternResolver resourcePatternResolv
8080
String[] schemaLocations = properties.getSchema().getLocations();
8181
Resource[] schemaResources = resolveSchemaResources(resourcePatternResolver, schemaLocations,
8282
properties.getSchema().getFileExtensions());
83-
GraphQlSource.Builder builder = GraphQlSource.builder().schemaResources(schemaResources)
84-
.exceptionResolvers(toList(exceptionResolvers)).instrumentation(toList(instrumentations));
83+
GraphQlSource.SchemaResourceBuilder builder = GraphQlSource.schemaResourceBuilder()
84+
.schemaResources(schemaResources).exceptionResolvers(toList(exceptionResolvers))
85+
.instrumentation(toList(instrumentations));
8586
if (!properties.getSchema().getIntrospection().isEnabled()) {
8687
builder.configureRuntimeWiring(this::enableIntrospection);
8788
}

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020

2121
/**
2222
* Callback interface that can be implemented by beans wishing to customize properties of
23-
* {@link org.springframework.graphql.execution.GraphQlSource.Builder Builder} whilst
24-
* retaining default auto-configuration.
23+
* {@link org.springframework.graphql.execution.GraphQlSource.SchemaResourceBuilder
24+
* Builder} whilst retaining default auto-configuration.
2525
*
2626
* @author Rossen Stoyanchev
2727
* @since 2.7.0
@@ -30,10 +30,11 @@
3030
public interface GraphQlSourceBuilderCustomizer {
3131

3232
/**
33-
* Customize the {@link org.springframework.graphql.execution.GraphQlSource.Builder
33+
* Customize the
34+
* {@link org.springframework.graphql.execution.GraphQlSource.SchemaResourceBuilder
3435
* Builder} instance.
3536
* @param builder builder the builder to customize
3637
*/
37-
void customize(GraphQlSource.Builder builder);
38+
void customize(GraphQlSource.SchemaResourceBuilder builder);
3839

3940
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
import org.springframework.beans.factory.ObjectProvider;
2525
import org.springframework.boot.autoconfigure.graphql.GraphQlSourceBuilderCustomizer;
26-
import org.springframework.graphql.execution.GraphQlSource.Builder;
26+
import org.springframework.graphql.execution.GraphQlSource;
2727
import org.springframework.graphql.execution.RuntimeWiringConfigurer;
2828

2929
/**
@@ -59,7 +59,7 @@ class GraphQlQuerydslSourceBuilderCustomizer<E, R> implements GraphQlSourceBuild
5959
}
6060

6161
@Override
62-
public void customize(Builder builder) {
62+
public void customize(GraphQlSource.SchemaResourceBuilder builder) {
6363
if (!this.executors.isEmpty() || !this.reactiveExecutors.isEmpty()) {
6464
builder.configureRuntimeWiring(this.wiringConfigurerFactory.apply(this.executors, this.reactiveExecutors));
6565
}

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -186,8 +186,9 @@ void shouldConfigureCustomBatchLoaderRegistry() {
186186
static class CustomGraphQlBuilderConfiguration {
187187

188188
@Bean
189-
GraphQlSource.Builder customGraphQlSourceBuilder() {
190-
return GraphQlSource.builder().schemaResources(new ClassPathResource("graphql/schema.graphqls"),
189+
GraphQlSource.SchemaResourceBuilder customGraphQlSourceBuilder() {
190+
return GraphQlSource.schemaResourceBuilder().schemaResources(
191+
new ClassPathResource("graphql/schema.graphqls"),
191192
new ClassPathResource("graphql/types/book.graphqls"));
192193
}
193194

@@ -200,7 +201,7 @@ static class CustomGraphQlSourceConfiguration {
200201
GraphQlSource customGraphQlSource() {
201202
ByteArrayResource schemaResource = new ByteArrayResource(
202203
"type Query { greeting: String }".getBytes(StandardCharsets.UTF_8));
203-
return GraphQlSource.builder().schemaResources(schemaResource).build();
204+
return GraphQlSource.schemaResourceBuilder().schemaResources(schemaResource).build();
204205
}
205206

206207
}
@@ -258,7 +259,7 @@ public static class CustomGraphQlSourceBuilderCustomizer implements GraphQlSourc
258259
public boolean applied = false;
259260

260261
@Override
261-
public void customize(GraphQlSource.Builder builder) {
262+
public void customize(GraphQlSource.SchemaResourceBuilder builder) {
262263
this.applied = true;
263264
}
264265

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
import org.springframework.core.type.classreading.MetadataReaderFactory;
4646
import org.springframework.core.type.classreading.SimpleMetadataReaderFactory;
4747
import org.springframework.graphql.execution.DataFetcherExceptionResolver;
48-
import org.springframework.graphql.execution.GraphQlSource.Builder;
48+
import org.springframework.graphql.execution.GraphQlSource;
4949
import org.springframework.graphql.execution.RuntimeWiringConfigurer;
5050
import org.springframework.graphql.server.WebGraphQlInterceptor;
5151
import org.springframework.graphql.server.WebGraphQlRequest;
@@ -267,7 +267,7 @@ public InstrumentationContext<Object> beginFieldFetch(InstrumentationFieldFetchP
267267
static class ExampleGraphQlSourceBuilderCustomizer implements GraphQlSourceBuilderCustomizer {
268268

269269
@Override
270-
public void customize(Builder builder) {
270+
public void customize(GraphQlSource.SchemaResourceBuilder builder) {
271271

272272
}
273273

0 commit comments

Comments
 (0)