This microservice is built using Spring Boot and Spring WebFlux to provide an asynchronous, non-blocking REST API. It interacts with a MongoDB NoSQL database to store and retrieve product information.
- Retrieve products by EAN code.
- Retrieve a product by EAN code and Store ID.
- Uses Spring Data Reactive MongoDB for database interactions.
- Asynchronous handling with Spring WebFlux.
- Includes unit tests with JUnit 5 and Mockito.
- Java 17
- Spring Boot 3
- Spring WebFlux
- Spring Data MongoDB (Reactive)
- MongoDB
- JUnit 5 & Mockito (for testing)
- Maven
Request:
GET /products/ean/{ean}
Example:
curl -X GET "http://localhost:8080/products/ean/123456789" -H "Content-Type: application/json"
Request:
GET /products/ean/{ean}/store/{storeId}
Example:
curl -X GET "http://localhost:8080/products/ean/123456789/store/1" -H "Content-Type: application/json"
git clone https://github.com/selmaguedidi/springreactiveproject.git
Ensure MongoDB is running locally or update application.properties to connect to a remote MongoDB instance.
mvn clean install
mvn spring-boot:run
The application will start on http://localhost:8080.
mvn test