Skip to content

Commit 68806bf

Browse files
committed
Fix build after Spring for GraphQL changes
See spring-projects/spring-graphql#244
1 parent b67cc62 commit 68806bf

File tree

3 files changed

+18
-12
lines changed

3 files changed

+18
-12
lines changed

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2021 the original author or authors.
2+
* Copyright 2002-2022 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.
@@ -16,7 +16,6 @@
1616

1717
package org.springframework.boot.autoconfigure.graphql.data;
1818

19-
import java.util.Collections;
2019
import java.util.List;
2120
import java.util.stream.Collectors;
2221

@@ -43,8 +42,9 @@
4342
* matching return type.
4443
*
4544
* @author Rossen Stoyanchev
45+
* @author Brian Clozel
4646
* @since 2.7.0
47-
* @see QuerydslDataFetcher#autoRegistrationTypeVisitor(List, List)
47+
* @see QuerydslDataFetcher#autoRegistrationConfigurer(List, List)
4848
*/
4949
@Configuration(proxyBeanMethods = false)
5050
@ConditionalOnClass({ GraphQL.class, QuerydslDataFetcher.class, QuerydslPredicateExecutor.class })
@@ -59,11 +59,11 @@ public GraphQlSourceBuilderCustomizer querydslRegistrar(
5959

6060
return (builder) -> {
6161
List<QuerydslPredicateExecutor<?>> executors = executorsProvider.stream().collect(Collectors.toList());
62-
List<ReactiveQuerydslPredicateExecutor<?>> reactiveExecutors = reactiveExecutorsProvider.stream()
63-
.collect(Collectors.toList());
6462
if (!executors.isEmpty()) {
65-
builder.typeVisitors(Collections
66-
.singletonList(QuerydslDataFetcher.autoRegistrationTypeVisitor(executors, reactiveExecutors)));
63+
List<ReactiveQuerydslPredicateExecutor<?>> reactiveExecutors = reactiveExecutorsProvider.stream()
64+
.collect(Collectors.toList());
65+
builder.configureRuntimeWiring(
66+
QuerydslDataFetcher.autoRegistrationConfigurer(executors, reactiveExecutors));
6767
}
6868
};
6969
}

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2021 the original author or authors.
2+
* Copyright 2002-2022 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.
@@ -42,8 +42,9 @@
4242
* matching return type.
4343
*
4444
* @author Rossen Stoyanchev
45+
* @author Brian Clozel
4546
* @since 2.7.0
46-
* @see QuerydslDataFetcher#autoRegistrationTypeVisitor(List, List)
47+
* @see QuerydslDataFetcher#autoRegistrationConfigurer(List, List)
4748
*/
4849
@Configuration(proxyBeanMethods = false)
4950
@ConditionalOnClass({ GraphQL.class, QuerydslDataFetcher.class, ReactiveQuerydslPredicateExecutor.class })
@@ -59,8 +60,8 @@ public GraphQlSourceBuilderCustomizer reactiveQuerydslRegistrar(
5960
List<ReactiveQuerydslPredicateExecutor<?>> executors = executorsProvider.stream()
6061
.collect(Collectors.toList());
6162
if (!executors.isEmpty()) {
62-
builder.typeVisitors(Collections.singletonList(
63-
QuerydslDataFetcher.autoRegistrationTypeVisitor(Collections.emptyList(), executors)));
63+
builder.configureRuntimeWiring(
64+
QuerydslDataFetcher.autoRegistrationConfigurer(Collections.emptyList(), executors));
6465
}
6566
};
6667
}

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616

1717
package org.springframework.boot.autoconfigure.graphql;
1818

19+
import java.nio.charset.StandardCharsets;
20+
1921
import graphql.GraphQL;
2022
import graphql.execution.instrumentation.ChainedInstrumentation;
2123
import graphql.execution.instrumentation.Instrumentation;
@@ -30,6 +32,7 @@
3032
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
3133
import org.springframework.context.annotation.Bean;
3234
import org.springframework.context.annotation.Configuration;
35+
import org.springframework.core.io.ByteArrayResource;
3336
import org.springframework.core.io.ClassPathResource;
3437
import org.springframework.graphql.GraphQlService;
3538
import org.springframework.graphql.data.method.annotation.support.AnnotatedControllerConfigurer;
@@ -182,7 +185,9 @@ static class CustomGraphQlSourceConfiguration {
182185

183186
@Bean
184187
GraphQlSource customGraphQlSource() {
185-
return mock(GraphQlSource.class);
188+
ByteArrayResource schemaResource = new ByteArrayResource(
189+
"type Query { greeting: String }".getBytes(StandardCharsets.UTF_8));
190+
return GraphQlSource.builder().schemaResources(schemaResource).build();
186191
}
187192

188193
}

0 commit comments

Comments
 (0)