Skip to content

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

Closed
@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

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions