mirror of
https://github.com/spring-projects/spring-framework
synced 2026-06-08 17:33:33 +00:00
Do not restart contexts if pausing is disabled
If the PauseMode is set to NEVER, we never pause contexts and therefore do not need to restart them. See gh-36117
This commit is contained in:
+9
-7
@@ -172,13 +172,15 @@ public class DefaultContextCache implements ContextCache {
|
||||
}
|
||||
|
||||
private void restartContextIfNecessary(ApplicationContext context) {
|
||||
// Recurse up the context hierarchy first.
|
||||
ApplicationContext parent = context.getParent();
|
||||
if (parent != null) {
|
||||
restartContextIfNecessary(parent);
|
||||
}
|
||||
if (context instanceof ConfigurableApplicationContext cac && !cac.isRunning()) {
|
||||
cac.restart();
|
||||
if (this.pauseMode != PauseMode.NEVER) {
|
||||
// Recurse up the context hierarchy first.
|
||||
ApplicationContext parent = context.getParent();
|
||||
if (parent != null) {
|
||||
restartContextIfNecessary(parent);
|
||||
}
|
||||
if (context instanceof ConfigurableApplicationContext cac && !cac.isRunning()) {
|
||||
cac.restart();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user