|
73 | 73 | import org.springframework.beans.factory.annotation.Qualifier; |
74 | 74 | import org.springframework.boot.autoconfigure.AutoConfigureAfter; |
75 | 75 | import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; |
| 76 | +import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression; |
76 | 77 | import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; |
77 | 78 | import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; |
78 | 79 | import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication; |
@@ -128,17 +129,15 @@ public GraphQLErrorStartupListener graphQLErrorStartupListener( |
128 | 129 |
|
129 | 130 | @Bean |
130 | 131 | @ConditionalOnClass(CorsFilter.class) |
| 132 | + @Conditional(CorsEnabledCondition.class) |
131 | 133 | @ConfigurationProperties("graphql.servlet.cors") |
132 | 134 | public CorsConfiguration corsConfiguration() { |
133 | 135 | return new CorsConfiguration(); |
134 | 136 | } |
135 | 137 |
|
136 | 138 | @Bean |
137 | 139 | @ConditionalOnClass(CorsFilter.class) |
138 | | - @ConditionalOnProperty( |
139 | | - value = "graphql.servlet.corsEnabled", |
140 | | - havingValue = "true", |
141 | | - matchIfMissing = true) |
| 140 | + @Conditional(CorsEnabledCondition.class) |
142 | 141 | public CorsFilter corsConfigurer(CorsConfiguration corsConfiguration) { |
143 | 142 | Map<String, CorsConfiguration> corsConfigurations = new LinkedHashMap<>(1); |
144 | 143 | if (corsConfiguration.getAllowedMethods() == null) { |
@@ -303,12 +302,17 @@ public GraphQLConfiguration graphQLServletConfiguration( |
303 | 302 | @Autowired(required = false) GraphQLResponseCacheManager responseCacheManager, |
304 | 303 | @Autowired(required = false) AsyncTaskDecorator asyncTaskDecorator, |
305 | 304 | @Autowired(required = false) @Qualifier("graphqlAsyncTaskExecutor") Executor asyncExecutor) { |
306 | | - Duration asyncTimeout = Optional.ofNullable(asyncServletProperties.getTimeout()) // |
307 | | - .orElse(AsyncServletProperties.DEFAULT_TIMEOUT); |
308 | | - long asyncTimeoutMilliseconds = Optional.ofNullable(graphQLServletProperties.getAsyncTimeout()) // |
309 | | - .orElse(asyncTimeout).toMillis(); |
310 | | - long subscriptionTimeoutMilliseconds = Optional.ofNullable(graphQLServletProperties.getSubscriptionTimeout()) // |
311 | | - .orElse(GraphQLServletProperties.DEFAULT_SUBSCRIPTION_TIMEOUT).toMillis(); |
| 305 | + Duration asyncTimeout = |
| 306 | + Optional.ofNullable(asyncServletProperties.getTimeout()) // |
| 307 | + .orElse(AsyncServletProperties.DEFAULT_TIMEOUT); |
| 308 | + long asyncTimeoutMilliseconds = |
| 309 | + Optional.ofNullable(graphQLServletProperties.getAsyncTimeout()) // |
| 310 | + .orElse(asyncTimeout) |
| 311 | + .toMillis(); |
| 312 | + long subscriptionTimeoutMilliseconds = |
| 313 | + Optional.ofNullable(graphQLServletProperties.getSubscriptionTimeout()) // |
| 314 | + .orElse(GraphQLServletProperties.DEFAULT_SUBSCRIPTION_TIMEOUT) |
| 315 | + .toMillis(); |
312 | 316 | return GraphQLConfiguration.with(invocationInputFactory) |
313 | 317 | .with(graphQLInvoker) |
314 | 318 | .with(graphQLObjectMapper) |
|
0 commit comments