@ -39,6 +39,7 @@ import org.junit.jupiter.params.provider.ValueSource;
import org.springframework.boot.autoconfigure.AutoConfigurations ;
import org.springframework.boot.autoconfigure.validation.ValidationAutoConfiguration ;
import org.springframework.boot.autoconfigure.validation.ValidatorAdapter ;
import org.springframework.boot.autoconfigure.web.reactive.WebFluxAutoConfiguration.WebFluxConfig ;
import org.springframework.boot.test.context.runner.ReactiveWebApplicationContextRunner ;
import org.springframework.boot.web.codec.CodecCustomizer ;
import org.springframework.boot.web.reactive.filter.OrderedHiddenHttpMethodFilter ;
@ -66,6 +67,7 @@ import org.springframework.validation.beanvalidation.LocalValidatorFactoryBean;
import org.springframework.web.filter.reactive.HiddenHttpMethodFilter ;
import org.springframework.web.reactive.HandlerMapping ;
import org.springframework.web.reactive.accept.RequestedContentTypeResolver ;
import org.springframework.web.reactive.config.DelegatingWebFluxConfiguration ;
import org.springframework.web.reactive.config.WebFluxConfigurationSupport ;
import org.springframework.web.reactive.config.WebFluxConfigurer ;
import org.springframework.web.reactive.function.server.support.RouterFunctionMapping ;
@ -544,6 +546,17 @@ class WebFluxAutoConfigurationTests {
} ) ;
}
@Test
@SuppressWarnings ( "rawtypes" )
void userConfigurersCanBeOrderedBeforeOrAfterTheAutoConfiguredConfigurer ( ) {
this . contextRunner . withBean ( HighPrecedenceConfigurer . class , HighPrecedenceConfigurer : : new )
. withBean ( LowPrecedenceConfigurer . class , LowPrecedenceConfigurer : : new )
. run ( ( context ) - > assertThat ( context . getBean ( DelegatingWebFluxConfiguration . class ) )
. extracting ( "configurers.delegates" ) . asList ( )
. extracting ( ( configurer ) - > ( Class ) configurer . getClass ( ) ) . containsExactly (
HighPrecedenceConfigurer . class , WebFluxConfig . class , LowPrecedenceConfigurer . class ) ) ;
}
private Map < PathPattern , Object > getHandlerMap ( ApplicationContext context ) {
HandlerMapping mapping = context . getBean ( "resourceHandlerMapping" , HandlerMapping . class ) ;
if ( mapping instanceof SimpleUrlHandlerMapping ) {
@ -787,4 +800,14 @@ class WebFluxAutoConfigurationTests {
}
@Order ( - 100 )
static class HighPrecedenceConfigurer implements WebFluxConfigurer {
}
@Order ( 100 )
static class LowPrecedenceConfigurer implements WebFluxConfigurer {
}
}