Skip to content

Provide deterministic behavior when management.server.port=0 #561

Open
@chriswhite199

Description

@chriswhite199

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions