Faster tests by reusing Testcontainers in Spring Boot

One of the aims of The Twelve-Factor App is to reduce the difference between development and production and Testcontainers are a great way to start the exact external services needed for Spring Boot integration tests. However, the existing JUnit 5 Spring Boot integration for Testcontainers comes with a number of downsides. We’ll briefly discuss these and a way to solve them using a ContextCustomizerFactory. Working sources for the examples below can be found at mpkorstanje/blog-spring-boot-test-containers....

January 2, 2022