WebFluxAutoConfiguration injects ResourceHandlerRegistrationCustomizer using ObjectProvider.getIfAvailable(): https://github.com/spring-projects/spring-boot/blob/8964203688c111e11604bc4454743998bc387993/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/reactive/WebFluxAutoConfiguration.java#L181

When multiple ResourceHandlerRegistrationCustomizer are in the context, this causes the WebFlux auto config to use an arbitrary one of them, instead of all of them.

In my case, webjars-locator-light joined my classpath due to a version update of another library. Due to this, @ConditionalOnEnabledResourceChain started matching, causing Boot to define its own customizer bean here: https://github.com/spring-projects/spring-boot/blob/8964203688c111e11604bc4454743998bc387993/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/reactive/WebFluxAutoConfiguration.java#L351-L361

This instance is the one that ends up being used, and my own is ignored.

I propose to allow an arbitrary number of customizer beans to work here, similar to the various other customizer callback interfaces used in Spring Boot's auto-configuration.


I'm currently working around this issue by marking my bean as @Primary.

Comment From: wilkinsona

Closing in favor of #43494. Thanks for the PR, @nosan.