Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/bmike2047/springboot-mongodb-embedded

Run Spring Boot mongo tests on an embedded MongoDB instance
https://github.com/bmike2047/springboot-mongodb-embedded

flapdoodle-embed-mongo java jdk17 mongodb mongodb-database mongodb-embedded spring spring-boot

Last synced: about 1 month ago
JSON representation

Run Spring Boot mongo tests on an embedded MongoDB instance

Awesome Lists containing this project

README

        

Spring Boot MongoDB embedded
--
![](assets/images/logo3.png)

### 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.
![](assets/images/screen1.png)