Open
Description
As observed in spring-cloud/spring-cloud-consul#555, when using management.server.port = 0
calls to ManagementServerPortUtils.getPort
return 0, rather than the dynamic assigned address.
Not sure of the official solution for this, but can ManagementServerPortUtils
be extended to add an ApplicationEvent listener and update the port if / when dynamic ports are being used.
Granted there is a potential for a sort-of-race condition here, where a caller might try and get the port value before the application event has fired, but in my experience, the actuator events usually fire before the main application starts.