Overview
The cache of application contexts becomes too big when running a complete suite of tests that each load a full ApplicationContext with a JPA EntityManagerFactory. There are situations where a tiny difference in the configuration forces us to load a different context.
Since the context cache is only there for performance reasons, its maximum size should be configurable – a system property might be the best choice, while no property means unbounded size – so that the least recently used can be properly closed and evicted from the cache.
Deliverables
Introduce a mechanism for configuring the maximum number of contexts that should be cached at any given time.
Possible mechanisms include: simple system property or a system property supported via SpringProperties.
Redesign DefaultContextCache to implement an LRU cache eviction algorithm.
Ensure that evicted contexts get properly closed.
Consider internally delegating to a third-party implementation such as a Guava cache.
- is related to
-
SPR-5863 Allow for concurrent test execution in the TestContext framework
-
- Closed
-
-
SPR-13722 Support 'throw-away' context for a test class
-
- Open
-
-
SPR-11576 Introduce system property to disable context caching in the TestContext framework
-
- Resolved
-
- supersedes
-
SPR-7687 Use soft or weak references for context caching in the TestContext framework
-
- Resolved
-