Skip to content

Declare a public constant for the WebServerStartStopLifecycle's phase #45572

Open
@SmokeIT

Description

@SmokeIT

The (servlet and reactive) WebServerStartStopLifecycle.getPhase() method is currently hardcoded as:

@Override
public int getPhase() {
    return WebServerGracefulShutdownLifecycle.SMART_LIFECYCLE_PHASE - 1024;
}

It would be nice if this phase was declared as a public constant. This would make it easier to start a custom SmartLifecycle before an application starts accepting HTTP requests.

Currently we declare our own constant for this, but there is no guarantee the WebServerStartStopLifecycle phase will never change.

It is also not possible to depend on the webServerStartStop bean in order to obtain its phase, since dependency relationships take precedence over phases. That is, if Bean A depends on the webServerStartStop bean, it will be started after the webServerStartStop bean, regardless of Bean A's phase.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions