This project is for a demonstration of how we can use the MongoDB in Spring Boot web application, here I am managing the Users, by performing CRUD operations. Here User has relationships with Contact and Car. Contact is embedded with User, and Car is a reference collection, Here the user has only one Contact, but Car can be multiple
For building and running the application you need:
- Git
- JDK 8 or later
- Gradle 6.3
- Spring Boot
- MongoDB
- Lombok
- MapStruct
- Apache Commons Lang
- Swagger
- IDE
-
Download the zip or clone the Git repository
-
Open build.gradle file from your favorite IDE
-
Select option Open as Project in your IDE
-
Start MongoDB
-
Config MongoDB properties from
src/main/resources/application-local.yml
-
Go to the
com.user.management.UserManagementMongodbDemoApplication
and run the class. Or you can open the IDE terminal and simply run the following commandgradlew bootrun
You can open the swagger to access the APIs: Swagger
You can check this project on the live instance, hit this URL Swagger on Live Instance to get familiar with the APIs.
This App is deployed on Heroku, and it's using MongoDB clusters deployed on Azure, to store data.
The database will be reset every Monday for memory management.
In case if you have docker in your machine then just go inside the mongodb-user-management-demo directory and execute the following command:
docker-compose up
And done.
Now you can open the swagger to access the APIs: Swagger