The DB Integration Service is a Spring Boot–based microservice that integrates data between MongoDB and MySQL.
It provides RESTful APIs to insert student records into MongoDB and then synchronize them into MySQL.
This project demonstrates how to connect multiple databases in a single Spring Boot application.
This service allows you to:
- Insert student records into MongoDB.
- Retrieve student records directly from MongoDB.
- Synchronize student data from MongoDB → MySQL.
- Manage multiple data sources in one Spring Boot service.
It’s a great starting point for learning how to:
- Use Spring Data JPA with MySQL.
- Use Spring Data MongoDB with MongoDB.
- Expose REST APIs for multi-database integration.
- Sync data between a NoSQL and a relational database.
- Insert student records into MongoDB.
- Retrieve students from MongoDB.
- Sync data between MongoDB and MySQL.
- Clean separation of Controller, Service, and Repository layers.
- Java 17
- Spring Boot (REST APIs, dependency injection)
- MongoDB (NoSQL database)
- MySQL (Relational database)
- Spring Data JPA & Spring Data MongoDB
- Maven (Build tool)
HTTP Method | Endpoint | Description |
---|---|---|
POST |
/students/mongo |
Inserts a student into MongoDB |
GET |
/students/mongo |
Retrieves all students from MongoDB |
POST |
/students/sync |
Syncs data from MongoDB → MySQL |
Before running the project, ensure you have:
- Java 17+ installed
- Maven installed
- MongoDB running locally
(Default:mongodb://127.0.0.1:27017
) - MySQL running locally
(Default:jdbc:mysql://localhost:3306/studentdb
)
- Clone the repository:
git clone https://github.com/sreeja23ed/db-integration-service.git cd db-integration-service