Skip to content
Spring Boot tests with Testcontainers and PostgreSQL
Java Dockerfile TSQL
Branch: master
Clone or download

Latest commit

Fetching latest commit…
Cannot retrieve the latest commit at this time.

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.mvn/wrapper
src Cleanup useless code, simplified the project, prepared for the blog p… Mar 22, 2020
.gitignore Readme Mar 21, 2020
Dockerfile
README.md
docker-compose.yml
mvnw
mvnw.cmd
pom.xml

README.md

Spring Boot tests with Testcontainers and PostgreSQL

References

Package the application

  • Package the application

$ ./mvnw clean package

To skip the tests use: -DskipTests=true

  • Extract libraries from fat-jar

$ mkdir -p target/dependency && (cd target/dependency; jar -xf ../*.jar)

Run

$ docker-compose build && docker-compose up

Verify the application is running

Application listens on port 9000.

$ http get :9000/owners

HTTP/1.1 200
Connection: keep-alive

{
    "_embedded": {
        "owners": []
    },
    "_links": {
        "profile": {
            "href": "http://localhost:8080/profile/owners"
        },
        "self": {
            "href": "http://localhost:8080/owners{?page,size,sort}",
            "templated": true
        }
    },
    "page": {
        "number": 0,
        "size": 20,
        "totalElements": 0,
        "totalPages": 0
    }
}
You can’t perform that action at this time.