-
Notifications
You must be signed in to change notification settings - Fork 705
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Provide deterministic behavior when management.server.port=0 #561
Comments
I think that we need to align with what spring boot has done. |
We still have logic similar to your For the purposes of registration with service discovery, I think I'd listen for the |
There's a public class in Boot 2.0+ called |
Looks like we both got there at the same time! |
I think Is there a way to tell if |
@spencergibb take a look at |
Looks like this could go in Greenwich (so 2.1.x branch) and merged forward. |
As observed in spring-cloud/spring-cloud-consul#555, when using
management.server.port = 0
calls toManagementServerPortUtils.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.
The text was updated successfully, but these errors were encountered: