Testcontainers
A library that starts real dependencies (PostgreSQL, Kafka, Redis) in Docker containers for the duration of a test.
Definition
Instead of an in-memory substitute like H2, integration tests run against the same database engine and version as production. Containers start before the tests, Spring Boot connects to them through @ServiceConnection, and they're thrown away afterwards. Sharing one container and one Spring context across test classes keeps the suite fast.
In practice
A repository test starts postgres:17 and checks that a native query with a JSONB operator really works.