Skip to content

Commit 61df497

Browse files
committed
Revise reference docs regarding new ApplicationContext pause() support
See gh-35269
1 parent e590341 commit 61df497

File tree

1 file changed

+4
-2
lines changed
  • framework-docs/modules/ROOT/pages/testing/testcontext-framework/ctx-management

1 file changed

+4
-2
lines changed

framework-docs/modules/ROOT/pages/testing/testcontext-framework/ctx-management/caching.adoc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,15 @@ alternative, you can set the same property via the
6363
xref:appendix.adoc#appendix-spring-properties[`SpringProperties`] mechanism.
6464

6565
As of Spring Framework 7.0, an application context stored in the context cache will be
66-
stopped when it is no longer actively in use and automatically restarted the next time
66+
_paused_ when it is no longer actively in use and automatically _restarted_ the next time
6767
the context is retrieved from the cache. Specifically, the latter will restart all
6868
auto-startup beans in the application context, effectively restoring the lifecycle state.
6969
This ensures that background processes within the context are not actively running while
7070
the context is not used by tests. For example, JMS listener containers, scheduled tasks,
7171
and any other components in the context that implement `Lifecycle` or `SmartLifecycle`
72-
will be in a "stopped" state until the context is used again by a test.
72+
will be in a "stopped" state until the context is used again by a test. Note, however,
73+
that `SmartLifecycle` components can opt out of pausing by returning `false` from
74+
`SmartLifecycle#isPauseable()`.
7375

7476
Since having a large number of application contexts loaded within a given test suite can
7577
cause the suite to take an unnecessarily long time to run, it is often beneficial to

0 commit comments

Comments
 (0)