|
39 | 39 | import org.springframework.boot.autoconfigure.AutoConfigurations;
|
40 | 40 | import org.springframework.boot.autoconfigure.validation.ValidationAutoConfiguration;
|
41 | 41 | import org.springframework.boot.autoconfigure.validation.ValidatorAdapter;
|
| 42 | +import org.springframework.boot.autoconfigure.web.reactive.WebFluxAutoConfiguration.WebFluxConfig; |
42 | 43 | import org.springframework.boot.test.context.runner.ReactiveWebApplicationContextRunner;
|
43 | 44 | import org.springframework.boot.web.codec.CodecCustomizer;
|
44 | 45 | import org.springframework.boot.web.reactive.filter.OrderedHiddenHttpMethodFilter;
|
|
66 | 67 | import org.springframework.web.filter.reactive.HiddenHttpMethodFilter;
|
67 | 68 | import org.springframework.web.reactive.HandlerMapping;
|
68 | 69 | import org.springframework.web.reactive.accept.RequestedContentTypeResolver;
|
| 70 | +import org.springframework.web.reactive.config.DelegatingWebFluxConfiguration; |
69 | 71 | import org.springframework.web.reactive.config.WebFluxConfigurationSupport;
|
70 | 72 | import org.springframework.web.reactive.config.WebFluxConfigurer;
|
71 | 73 | import org.springframework.web.reactive.function.server.support.RouterFunctionMapping;
|
@@ -544,6 +546,17 @@ void customLocaleContextResolverWithDifferentNameDoesNotReplaceAutoConfiguredLoc
|
544 | 546 | });
|
545 | 547 | }
|
546 | 548 |
|
| 549 | + @Test |
| 550 | + @SuppressWarnings("rawtypes") |
| 551 | + void userConfigurersCanBeOrderedBeforeOrAfterTheAutoConfiguredConfigurer() { |
| 552 | + this.contextRunner.withBean(HighPrecedenceConfigurer.class, HighPrecedenceConfigurer::new) |
| 553 | + .withBean(LowPrecedenceConfigurer.class, LowPrecedenceConfigurer::new) |
| 554 | + .run((context) -> assertThat(context.getBean(DelegatingWebFluxConfiguration.class)) |
| 555 | + .extracting("configurers.delegates").asList() |
| 556 | + .extracting((configurer) -> (Class) configurer.getClass()).containsExactly( |
| 557 | + HighPrecedenceConfigurer.class, WebFluxConfig.class, LowPrecedenceConfigurer.class)); |
| 558 | + } |
| 559 | + |
547 | 560 | private Map<PathPattern, Object> getHandlerMap(ApplicationContext context) {
|
548 | 561 | HandlerMapping mapping = context.getBean("resourceHandlerMapping", HandlerMapping.class);
|
549 | 562 | if (mapping instanceof SimpleUrlHandlerMapping) {
|
@@ -787,4 +800,14 @@ public void setLocaleContext(ServerWebExchange exchange, LocaleContext localeCon
|
787 | 800 |
|
788 | 801 | }
|
789 | 802 |
|
| 803 | + @Order(-100) |
| 804 | + static class HighPrecedenceConfigurer implements WebFluxConfigurer { |
| 805 | + |
| 806 | + } |
| 807 | + |
| 808 | + @Order(100) |
| 809 | + static class LowPrecedenceConfigurer implements WebFluxConfigurer { |
| 810 | + |
| 811 | + } |
| 812 | + |
790 | 813 | }
|
0 commit comments