GitHunt
SP

sparsick/testcontainers-spring-boot

Demo Application for my blog posts about Testcontainers integration in Spring Boot tests

Testcontainers Integration in a Spring Boot Application

MavenBuild

This repository shows some samples how to integrate Testcontainers in JUnit5 tests in Spring Boot context.

It is the base for several blog posts.

Show Cases

It exists samples for following use cases:

Relational Database Integration

UI Tests

Test with AWS S3 Database Integration / Localstack

Spring Boot Demo Application

If you want to run the whole Spring Boot application, you have to follow the follwing steps.

First at all, a database is needed

docker run --name my-sql -p 3306:3306 -e MYSQL_ROOT_PASSWORD=my-secret-pw -e MYSQL_DATABASE=test -e MYSQL_USER=user -e MYSQL_PASSWORD=pwd -d mysql

Then you can start the application via the spring-boot-maven-plugin:

mvn spring-boot:run

After that, the application is available in a browser under the URL http://localhost:8080/hero