mirror of
https://github.com/spring-projects/spring-boot.git
synced 2026-09-17 20:19:06 +00:00
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