40
40
import org .springframework .graphql .execution .SubscriptionExceptionResolver ;
41
41
42
42
@ AutoConfiguration (before = GraphQlAutoConfiguration .class , after = GraphQLSchemaAutoConfiguration .class )
43
- @ ConditionalOnClass ({GraphQL .class , GraphQlSource .class , GraphQLSchemaConfigurer .class })
44
- @ ConditionalOnProperty (name = "spring.graphql.jpa.query.enabled" , havingValue = "true" , matchIfMissing = true )
43
+ @ ConditionalOnClass ({ GraphQL .class , GraphQlSource .class , GraphQLSchemaConfigurer .class })
44
+ @ ConditionalOnProperty (name = "spring.graphql.jpa.query.enabled" , havingValue = "true" , matchIfMissing = true )
45
45
@ EnableConfigurationProperties (GraphQlProperties .class )
46
46
public class GraphQLJpaQueryGraphQlSourceAutoConfiguration {
47
47
48
48
@ Bean
49
49
@ ConditionalOnGraphQlSchema
50
- GraphQLSchemaConfigurer graphQlSourceSchemaConfigurer (ListableBeanFactory beanFactory ,
51
- ResourcePatternResolver resourcePatternResolver ,
52
- GraphQlProperties properties ,
53
- ObjectProvider <DataFetcherExceptionResolver > exceptionResolvers ,
54
- ObjectProvider <SubscriptionExceptionResolver > subscriptionExceptionResolvers ,
55
- ObjectProvider <Instrumentation > instrumentations ,
56
- ObjectProvider <RuntimeWiringConfigurer > wiringConfigurers ,
57
- ObjectProvider <GraphQlSourceBuilderCustomizer > sourceCustomizers ) {
50
+ GraphQLSchemaConfigurer graphQlSourceSchemaConfigurer (
51
+ ListableBeanFactory beanFactory ,
52
+ ResourcePatternResolver resourcePatternResolver ,
53
+ GraphQlProperties properties ,
54
+ ObjectProvider <DataFetcherExceptionResolver > exceptionResolvers ,
55
+ ObjectProvider <SubscriptionExceptionResolver > subscriptionExceptionResolvers ,
56
+ ObjectProvider <Instrumentation > instrumentations ,
57
+ ObjectProvider <RuntimeWiringConfigurer > wiringConfigurers ,
58
+ ObjectProvider <GraphQlSourceBuilderCustomizer > sourceCustomizers
59
+ ) {
58
60
return registry -> {
59
61
GraphQlAutoConfiguration graphQlAutoConfiguration = new GraphQlAutoConfiguration (beanFactory );
60
62
61
- GraphQlSource graphQlSource = graphQlAutoConfiguration .graphQlSource (resourcePatternResolver ,
62
- properties ,
63
- exceptionResolvers ,
64
- subscriptionExceptionResolvers ,
65
- instrumentations ,
66
- wiringConfigurers ,
67
- sourceCustomizers );
63
+ GraphQlSource graphQlSource = graphQlAutoConfiguration .graphQlSource (
64
+ resourcePatternResolver ,
65
+ properties ,
66
+ exceptionResolvers ,
67
+ subscriptionExceptionResolvers ,
68
+ instrumentations ,
69
+ wiringConfigurers ,
70
+ sourceCustomizers
71
+ );
68
72
registry .register (graphQlSource .schema ());
69
73
};
70
74
}
71
75
72
76
@ Bean
73
77
@ ConditionalOnMissingBean (GraphQlSource .class )
74
78
@ ConditionalOnBean (GraphQLSchema .class )
75
- public GraphQlSource graphQlSource (GraphQLSchema graphQLSchema ,
76
- ObjectProvider <DataFetcherExceptionResolver > exceptionResolvers ,
77
- ObjectProvider <SubscriptionExceptionResolver > subscriptionExceptionResolvers ,
78
- ObjectProvider <Instrumentation > instrumentations ,
79
- ObjectProvider <Consumer <GraphQL .Builder >> configurers ) {
79
+ public GraphQlSource graphQlSource (
80
+ GraphQLSchema graphQLSchema ,
81
+ ObjectProvider <DataFetcherExceptionResolver > exceptionResolvers ,
82
+ ObjectProvider <SubscriptionExceptionResolver > subscriptionExceptionResolvers ,
83
+ ObjectProvider <Instrumentation > instrumentations ,
84
+ ObjectProvider <Consumer <GraphQL .Builder >> configurers
85
+ ) {
80
86
GraphQlSource .Builder <?> builder = GraphQlSource .builder (graphQLSchema );
81
87
82
- builder .exceptionResolvers (exceptionResolvers .orderedStream ().collect (Collectors .toList ()))
83
- .subscriptionExceptionResolvers (subscriptionExceptionResolvers .orderedStream ()
84
- .collect (Collectors .toList ()))
85
- .instrumentation (instrumentations .orderedStream ()
86
- .collect (Collectors .toList ()));
88
+ builder
89
+ .exceptionResolvers (exceptionResolvers .orderedStream ().collect (Collectors .toList ()))
90
+ .subscriptionExceptionResolvers (subscriptionExceptionResolvers .orderedStream ().collect (Collectors .toList ()))
91
+ .instrumentation (instrumentations .orderedStream ().collect (Collectors .toList ()));
87
92
88
- configurers .orderedStream ()
89
- .forEach (builder ::configureGraphQl );
93
+ configurers .orderedStream ().forEach (builder ::configureGraphQl );
90
94
91
95
return builder .build ();
92
96
}
@@ -96,5 +100,4 @@ public GraphQlSource graphQlSource(GraphQLSchema graphQLSchema,
96
100
public JavaScalarsRuntimeWiringConfigurer javaScalarsRuntimeWiringConfigurer () {
97
101
return new JavaScalarsRuntimeWiringConfigurer ();
98
102
}
99
-
100
103
}
0 commit comments