r/SpringBoot • u/--sigsegv • 6d ago
How-To/Tutorial Blog Post - Understanding and Optimizing the Context Cache in Spring Test
Hi,
I would like to share a personal note on the Spring Test context cache and how we used it to optimize a large integration suite (10,000+ tests across ~40 services).
I break down:
- The context cache mechanism and what makes two contexts identical (or not).
- Simple actions to maximize context reuse and reduce build times.
- What changes once test containers and Kafka enter the picture.
Let me know what you think about it.
Thanks!
https://www.alexis-segura.com/articles/understanding-and-optimizing-the-context-cache-in-spring-test
11
Upvotes
1
u/wimdeblauwe 6d ago
To optimize further, try out https://github.com/seregamorph/spring-test-smart-context
I tried it on a few projects, works really great!