This repository was archived by the owner on Dec 19, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +42
-4
lines changed
graphql-kickstart-spring-boot-autoconfigure-tools/src/main/java/graphql/kickstart/tools/boot
graphql-kickstart-spring-boot-autoconfigure-webflux/src/main
java/graphql/kickstart/spring/webflux/boot Expand file tree Collapse file tree 4 files changed +42
-4
lines changed Original file line number Diff line number Diff line change 44
44
@ Slf4j
45
45
@ Configuration
46
46
@ ConditionalOnClass (SchemaParser .class )
47
- @ AutoConfigureAfter ({ JacksonAutoConfiguration .class } )
47
+ @ AutoConfigureAfter (JacksonAutoConfiguration .class )
48
48
@ EnableConfigurationProperties (GraphQLToolsProperties .class )
49
49
public class GraphQLJavaToolsAutoConfiguration {
50
50
Original file line number Diff line number Diff line change 50
50
@ SuppressWarnings ("SpringJavaInjectionPointsAutowiringInspection" )
51
51
@ Slf4j
52
52
@ Configuration
53
- @ ConditionalOnBean ({ GraphQLSchema .class } )
54
- @ AutoConfigureAfter ({ GraphQLJavaToolsAutoConfiguration .class } )
53
+ @ ConditionalOnBean (GraphQLSchema .class )
54
+ @ AutoConfigureAfter (GraphQLJavaToolsAutoConfiguration .class )
55
55
@ Import ({GraphQLController .class , ReactiveWebSocketSubscriptionsHandler .class })
56
56
public class GraphQLSpringWebfluxAutoConfiguration {
57
57
Original file line number Diff line number Diff line change
1
+ package graphql .kickstart .spring .webflux .boot ;
2
+
3
+ import graphql .kickstart .tools .SchemaParser ;
4
+ import graphql .kickstart .tools .SchemaParserOptions .GenericWrapper ;
5
+ import graphql .kickstart .tools .boot .GraphQLJavaToolsAutoConfiguration ;
6
+ import java .util .List ;
7
+ import org .springframework .beans .factory .annotation .Autowired ;
8
+ import org .springframework .boot .autoconfigure .AutoConfigureBefore ;
9
+ import org .springframework .boot .autoconfigure .condition .ConditionalOnClass ;
10
+ import org .springframework .context .annotation .Bean ;
11
+ import org .springframework .context .annotation .Configuration ;
12
+ import reactor .core .publisher .Mono ;
13
+
14
+ @ Configuration
15
+ @ ConditionalOnClass (SchemaParser .class )
16
+ @ AutoConfigureBefore (GraphQLJavaToolsAutoConfiguration .class )
17
+ public class MonoAutoConfiguration {
18
+
19
+ @ Bean
20
+ GenericWrapper monoWrapper (@ Autowired (required = false ) List <GenericWrapper > genericWrappers ) {
21
+ if (notWrapsMono (genericWrappers )) {
22
+ return GenericWrapper .withTransformer (
23
+ Mono .class ,
24
+ 0 ,
25
+ Mono ::toFuture ,
26
+ t -> t
27
+ );
28
+ }
29
+ return null ;
30
+ }
31
+
32
+ private boolean notWrapsMono (List <GenericWrapper > genericWrappers ) {
33
+ return genericWrappers == null ||
34
+ genericWrappers .stream ().noneMatch (it -> it .getType ().isAssignableFrom (Mono .class ));
35
+ }
36
+
37
+ }
Original file line number Diff line number Diff line change 1
1
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
2
- graphql.kickstart.spring.webflux.boot.GraphQLSpringWebfluxAutoConfiguration
2
+ graphql.kickstart.spring.webflux.boot.GraphQLSpringWebfluxAutoConfiguration,\
3
+ graphql.kickstart.spring.webflux.boot.MonoAutoConfiguration
You can’t perform that action at this time.
0 commit comments