This repository shows multiple ways how to set up and use Testcontainers in a Spring Boot application, including the new @ServiceConnection
annotation.
Note that Postgres container is used just as an example and in case you're looking to integrate Spring Boot with a relational database container you may want to check Testcontainers' built-in JDBC support: https://www.testcontainers.org/modules/databases/jdbc/
Go directly here for examples 👉 https://github.com/maciej-scratches/spring-boot-3.1-service-connection-demo/tree/main/src/test/java/com/example