Skip to content

Introduce ConfigurableApplicationContext.restart() method #35171

@jhoeller

Description

@jhoeller

In preparation of #35168, we are introducing a ConfigurableApplicationContext.restart() method that is to be preferably used after a context-level stop() call, on reactivation of a context. This effectively restores the lifecycle state after refresh(), auto-starting all applicable components (SmartLifecycle.isAutoStartup()), rather than the hard-start of any lifecycle component in the context that a context-level start() does.

We have a variation of this for CRaC already but that's slightly different (tracking which components were actually started before) and not publicly callable. As a bonus, the new restart() method also auto-stops all running components before if necessary, so can also be used as a shortcut for a full stop-restart cycle.

Metadata

Metadata

Assignees

Labels

in: coreIssues in core modules (aop, beans, core, context, expression)type: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions