Browse Source

Revise Javadoc regarding new ApplicationContext pause() support

See gh-35269
pull/35285/head
Sam Brannen 5 months ago
parent
commit
e590341ca7
  1. 2
      spring-context/src/main/java/org/springframework/context/ConfigurableApplicationContext.java
  2. 4
      spring-context/src/main/java/org/springframework/context/event/ContextPausedEvent.java
  3. 4
      spring-test/src/main/java/org/springframework/test/context/CacheAwareContextLoaderDelegate.java
  4. 4
      spring-test/src/main/java/org/springframework/test/context/TestContext.java
  5. 4
      spring-test/src/main/java/org/springframework/test/context/support/DefaultTestContext.java
  6. 6
      spring-test/src/test/java/org/springframework/test/context/cache/EventTracker.java

2
spring-context/src/main/java/org/springframework/context/ConfigurableApplicationContext.java

@ -223,7 +223,7 @@ public interface ConfigurableApplicationContext extends ApplicationContext, Life @@ -223,7 +223,7 @@ public interface ConfigurableApplicationContext extends ApplicationContext, Life
/**
* Pause all beans in this application context if necessary, and subsequently
* restart all auto-startup beans, effectively restoring the lifecycle state
* after {@link #refresh()} (typically after a preceding {@link #stop()} call
* after {@link #refresh()} (typically after a preceding {@link #pause()} call
* when a full {@link #start()} of even lazy-starting beans is to be avoided).
* @since 7.0
* @see #pause()

4
spring-context/src/main/java/org/springframework/context/event/ContextPausedEvent.java

@ -35,8 +35,8 @@ import org.springframework.context.ConfigurableApplicationContext; @@ -35,8 +35,8 @@ import org.springframework.context.ConfigurableApplicationContext;
public class ContextPausedEvent extends ContextStoppedEvent {
/**
* Create a new {@code ContextRestartedEvent}.
* @param source the {@code ContextPausedEvent} that has been restarted
* Create a new {@code ContextPausedEvent}.
* @param source the {@code ApplicationContext} that has been paused
* (must not be {@code null})
*/
public ContextPausedEvent(ApplicationContext source) {

4
spring-test/src/main/java/org/springframework/test/context/CacheAwareContextLoaderDelegate.java

@ -169,8 +169,8 @@ public interface CacheAwareContextLoaderDelegate { @@ -169,8 +169,8 @@ public interface CacheAwareContextLoaderDelegate {
* for the supplied {@link MergedContextConfiguration} as well as usage of the
* application context for its {@linkplain MergedContextConfiguration#getParent()
* parent}, recursively.
* <p>This informs the {@code ContextCache} that the application context(s) can
* be safely {@linkplain org.springframework.context.Lifecycle#stop() stopped}
* <p>This informs the {@code ContextCache} that the application context(s) can be safely
* {@linkplain org.springframework.context.ConfigurableApplicationContext#pause() paused}
* if no other test classes are actively using the same application context(s).
* @param key the context key; never {@code null}
* @param testClass the test class that is no longer using the application context(s)

4
spring-test/src/main/java/org/springframework/test/context/TestContext.java

@ -135,8 +135,8 @@ public interface TestContext extends AttributeAccessor, Serializable { @@ -135,8 +135,8 @@ public interface TestContext extends AttributeAccessor, Serializable {
* Call this method to signal that the {@linkplain #getTestClass() test class}
* is no longer using the {@linkplain ApplicationContext application context}
* associated with this test context.
* <p>This informs the context cache that the application context can be
* safely {@linkplain org.springframework.context.Lifecycle#stop() stopped}
* <p>This informs the context cache that the application context can be safely
* {@linkplain org.springframework.context.ConfigurableApplicationContext#pause() paused}
* if no other test classes are actively using the same application context.
* <p>This method is intended to be invoked after execution of the test class
* has ended and should not be invoked unless the application context for this

4
spring-test/src/main/java/org/springframework/test/context/support/DefaultTestContext.java

@ -143,8 +143,8 @@ public class DefaultTestContext implements TestContext { @@ -143,8 +143,8 @@ public class DefaultTestContext implements TestContext {
/**
* Mark the {@linkplain ApplicationContext application context} associated
* with this test context as <em>unused</em> so that it can be safely
* {@linkplain org.springframework.context.Lifecycle#stop() stopped} if no
* other test classes are actively using the same application context.
* {@linkplain org.springframework.context.ConfigurableApplicationContext#pause() paused}
* if no other test classes are actively using the same application context.
* <p>The default implementation delegates to the {@link CacheAwareContextLoaderDelegate}
* that was supplied when this {@code TestContext} was constructed.
* @since 7.0

6
spring-test/src/test/java/org/springframework/test/context/cache/EventTracker.java vendored

@ -22,9 +22,9 @@ import java.util.List; @@ -22,9 +22,9 @@ import java.util.List;
import org.springframework.context.ApplicationEvent;
import org.springframework.context.event.ApplicationContextEvent;
import org.springframework.context.event.ContextClosedEvent;
import org.springframework.context.event.ContextPausedEvent;
import org.springframework.context.event.ContextRefreshedEvent;
import org.springframework.context.event.ContextRestartedEvent;
import org.springframework.context.event.ContextStoppedEvent;
import org.springframework.context.event.EventListener;
import org.springframework.stereotype.Component;
import org.springframework.test.context.event.TestContextEvent;
@ -51,8 +51,8 @@ class EventTracker { @@ -51,8 +51,8 @@ class EventTracker {
trackApplicationContextEvent(event);
}
@EventListener(ContextStoppedEvent.class)
void contextStopped(ContextStoppedEvent event) {
@EventListener(ContextPausedEvent.class)
void contextPaused(ContextPausedEvent event) {
trackApplicationContextEvent(event);
}

Loading…
Cancel
Save