Skip to content

Run Spring Boot mongo tests on an embedded MongoDB instance

Notifications You must be signed in to change notification settings

bmike2047/springboot-mongodb-embedded

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Spring Boot MongoDB embedded

Description

This project is an example of using Spring Boot with MongoDB but more particular testing is done using an embedded MongoDB instance instead of docker.
It includes a simple data model and repository.
The embedded MongoDB instance is running on localhost:27017

Usage

Requires JDK 17
To run the tests use the following gradle task:

./gradlew clean test

Tip

This embedded-MongoDB test ran on Ubuntu 22.04.4 which support MonogoDB 6.x and up. This is because of libcrypto.so was updated to version 3.x on Ubuntu 22.
If you require to run MonogoDB 4.x tests you need to run on an older Ubuntu version that has libcrypto.so.1.1 like Ubuntu 18.

Tip

I case you have older JDK version than JDK 17 and you are using IntelliJIDEA as IDE make sure Gradle JVM is set to JDK 17 in:
File | Settings | Build, Execution, Deployment | Build Tools | Gradle -> Gradle JVM

Screenshot

This was generated by putting a Thread.sleep() in the middle of the test and using Studio3T as a client to explore the embedded MongoDB instance.

Releases

No releases published

Packages

No packages published

Languages