~/talk

Improving Spring Boot test efficiency

Talkat Voxxed Days Thessaloniki 2025 · 2025-11-07..11-08· [java]
links:none on file
slides:none on file

Spring Integration Test contexts are cached by a merged configuration key, causing many simultaneous heavy contexts (TestContainers-managed Docker containers, thread pools) and a CI host to hit OOM after ~25 minutes with ~120 containers. Practical fixes: set spring.test.context.cache.maxSize (try 4 or 1), use static singleton docker containers with overridden destroy, lazy-initialize datasources, prebuild DB images (Mirror’s persistence-tooling), and reorder tests plus eagerly close contexts via a small library — results: far fewer active containers and up to ~2x or 30% faster suites.

AI-written summary · about

  1. 0:00Introduction
  2. 3:46Spring test inefficiencies
  3. 9:57Optimization goals
  4. 11:01@DirtiesContext and cache
  5. 13:49Unique test configs
  6. 15:16Docker singletons
  7. 16:43Pre-applying DB migrations
  8. 17:48Lazy data sources
  9. 19:14Dynamic ports
  10. 21:46Thread pool shutdown
  11. 22:50Test reordering
  12. 26:49Results and impact
  13. 28:59Context management benefits
  14. 31:03Open-source library
  15. 33:13Small vs large projects
  16. 34:41Test infrastructure
  17. 35:03Key takeaways
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.