spring-boot/spring-boot-project/spring-boot-actuator-autoconfigure
Andy Wilkinson 8ce7da9bb0 Avoid duplicate customization of management web server factory
Previously, customization was performed in two places:

1. By customizers defined in the reactive and servlet web servlet
   factory auto-configuration
     - ServletWebServerFactoryAutoConfiguration
     - ReactiveWebServerFactoryAutoConfiguration
 2. By a ManagementWebServerFactoryCustomizer that delegates to
    customizers of certain types found in the application context
    hierarchy.

This led to some double customization as the customizers registered
by the auto-configuration classes were also found and called by the
ManagementWebServerFactoryCustomizer.

Additionally, the ManagementWebServerFactoryCustomizer would find
customizers from the parent context registered by
EmbeddedWebServerFactoryCustomizerAutoConfiguration.

This commit reworks the customization of the management web server
factory to remove the double customization.
ManagementWebServerFactoryCustomizer no longer delegates to
customizers that it finds in the context hierarchy. This
prevents the customizers defined in the reactive and servlet web
server factory auto-configuration classes from being called twice.
Additionally, EmbeddedWebServerFactoryCustomizerAutoConfiguration is
now registered in the child context so that its customizers continue
to be called when preparing the management context web server
factory.

Closes gh-44151
2025-02-07 12:23:40 +00:00
..