|
45 | 45 | import org.springframework.core.io.ByteArrayResource;
|
46 | 46 | import org.springframework.core.io.ClassPathResource;
|
47 | 47 | import org.springframework.graphql.ExecutionGraphQlService;
|
| 48 | +import org.springframework.graphql.data.method.HandlerMethodArgumentResolver; |
48 | 49 | import org.springframework.graphql.data.method.annotation.support.AnnotatedControllerConfigurer;
|
49 | 50 | import org.springframework.graphql.data.pagination.EncodingCursorStrategy;
|
50 | 51 | import org.springframework.graphql.execution.BatchLoaderRegistry;
|
@@ -236,11 +237,20 @@ void whenApplicationTaskExecutorIsDefinedThenAnnotatedControllerConfigurerShould
|
236 | 237 | void whenCustomExecutorIsDefinedThenAnnotatedControllerConfigurerDoesNotUseIt() {
|
237 | 238 | this.contextRunner.withUserConfiguration(CustomExecutorConfiguration.class).run((context) -> {
|
238 | 239 | AnnotatedControllerConfigurer annotatedControllerConfigurer = context
|
239 |
| - .getBean(AnnotatedControllerConfigurer.class); |
| 240 | + .getBean(AnnotatedControllerConfigurer.class); |
240 | 241 | assertThat(annotatedControllerConfigurer).extracting("executor").isNull();
|
241 | 242 | });
|
242 | 243 | }
|
243 | 244 |
|
| 245 | + @Test |
| 246 | + void whenAHandlerMethodArgumentResolverIsDefinedThenAnnotatedControllerConfigurerShouldUseIt() { |
| 247 | + this.contextRunner.withUserConfiguration(CustomHandlerMethodArgumentResolverConfiguration.class).run((context) -> assertThat(context |
| 248 | + .getBean(AnnotatedControllerConfigurer.class)) |
| 249 | + .extracting("customArgumentResolvers") |
| 250 | + .asInstanceOf(InstanceOfAssertFactories.LIST) |
| 251 | + .hasSize(1)); |
| 252 | + } |
| 253 | + |
244 | 254 | @Configuration(proxyBeanMethods = false)
|
245 | 255 | static class CustomGraphQlBuilderConfiguration {
|
246 | 256 |
|
@@ -336,4 +346,12 @@ Executor customExecutor() {
|
336 | 346 |
|
337 | 347 | }
|
338 | 348 |
|
| 349 | + static class CustomHandlerMethodArgumentResolverConfiguration { |
| 350 | + |
| 351 | + @Bean |
| 352 | + HandlerMethodArgumentResolver customHandlerMethodArgumentResolver() { |
| 353 | + return mock(HandlerMethodArgumentResolver.class); |
| 354 | + } |
| 355 | + } |
| 356 | + |
339 | 357 | }
|
0 commit comments