Skip to content

sparsick/testcontainers-spring-boot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

95 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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