Reuse Testcontainers initialization and configuration code with JUnit 5 Extension Callbacks in your Spring Boot Integration Tests

1. OVERVIEW You are writing integration tests for your Spring Boot applications with Jupiter / JUnit 5 and Testcontainers . Take for instance this test class from Writing integration tests with Testcontainers and Microsoft’s Cosmos DB Docker emulator for Spring Boot applications : UserControllerTestContainersIntegrationTest.java : // ... @Testcontainers public class…