mirror of
https://github.com/spring-projects/spring-framework
synced 2026-06-08 17:33:33 +00:00
Introduce ConfigurableApplicationContext.pause() and SmartLifecycle.isPauseable()
Closes gh-35269
This commit is contained in:
+3
-3
@@ -93,8 +93,8 @@ public interface ContextCache {
|
||||
/**
|
||||
* Obtain a cached {@link ApplicationContext} for the given key.
|
||||
* <p>If the cached application context was previously
|
||||
* {@linkplain org.springframework.context.Lifecycle#stop() stopped}, it
|
||||
* must be
|
||||
* {@linkplain org.springframework.context.ConfigurableApplicationContext#pause() paused},
|
||||
* it must be
|
||||
* {@linkplain org.springframework.context.support.AbstractApplicationContext#restart()
|
||||
* restarted}. This applies to parent contexts as well.
|
||||
* <p>In addition, the {@linkplain #getHitCount() hit} and
|
||||
@@ -187,7 +187,7 @@ public interface ContextCache {
|
||||
* {@link MergedContextConfiguration} and any of its parents.
|
||||
* <p>If no other test classes are actively using the same application
|
||||
* context(s), the application context(s) should be
|
||||
* {@linkplain org.springframework.context.Lifecycle#stop() stopped}.
|
||||
* {@linkplain org.springframework.context.ConfigurableApplicationContext#pause() paused}.
|
||||
* <p>The default implementation of this method does nothing. Concrete
|
||||
* implementations are therefore highly encouraged to override this
|
||||
* method, {@link #registerContextUsage(MergedContextConfiguration, Class)},
|
||||
|
||||
+1
-1
@@ -187,7 +187,7 @@ public class DefaultContextCache implements ContextCache {
|
||||
activeTestClasses.remove(testClass);
|
||||
if (activeTestClasses.isEmpty()) {
|
||||
if (context instanceof ConfigurableApplicationContext cac && cac.isRunning()) {
|
||||
cac.stop();
|
||||
cac.pause();
|
||||
}
|
||||
this.contextUsageMap.remove(mergedConfig);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user