Skip to content

Limit size of context cache in the TestContext framework [SPR-8055] #12710

Closed
@spring-projects-issues

Description

@spring-projects-issues

Gaetan Pitteloud opened SPR-8055 and commented

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

  1. 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.
  2. 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.

Attachments:

Issue Links:

Referenced from: commits e18d5b5, ebeba43

1 votes, 6 watchers

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions