This commit fixes a regression where RANDOM_PORT was no longer honored
if a defined management port is set. Due to the modularization efforts,
the code has moved from an EnvironmentPostProcessor to an
ApplicationListener. Unfortunately, the listener is registered too
late to handle the event it is listening to. While the event type could
have been changed, the listener was added on the ApplicationContext
which are not honored before the ApplicationContext is in a state to be
used.
The contract of ContextCustomizerFactory is already giving us everything
we need. While the environment is post-processed later than we would
like, it is still post-processed before the refresh state so that the
additional property is honored.
This commit also adds an integration test to cover this scenario.
Closes gh-48653
Remove the `spring-boot-web-server-test` module, adding
`SpringBootTestRandomPortContextCustomizerFactory` to
`spring-boot-web-server` as a replacement for
`SpringBootTestRandomPortApplicationListener`.
See gh-46356
See gh-47322