Order management system built with Spring Boot, microservices, and hexagonal architecture.
This project implements a microservices architecture with the following components:
- Service Discovery (Eureka): Service registration and discovery
- API Gateway: Single entry point for all services
- Config Server: Centralized configuration
- User Service: User management
- Product Service: Product management
- Order Service: Order management
Each microservice follows the hexagonal architecture pattern (ports and adapters):
├── domain/ # Pure business logic
│ ├── model/ # Entities and Value Objects
│ ├── service/ # Domain services
│ └── event/ # Domain events
├── application/ # Use cases
│ ├── port/
│ │ ├── in/ # Input ports (interfaces)
│ │ └── out/ # Output ports (interfaces)
│ └── service/ # Use case implementation
└── infrastructure/ # Adapters
├── adapter/
│ ├── in/ # Input adapters (REST, etc.)
│ └── out/ # Output adapters (DB, messaging)
└── config/ # Spring configuration
- Java 17
- Spring Boot 3.2.2
- Spring Cloud 2023.0.0
- Oracle Database 21c
- RabbitMQ 3.12
- Maven
- Docker & Docker Compose
- Java 17 or higher
- Maven 3.8+
- Docker and Docker Compose
- Git
git clone <repository-url>
cd spring-microservices-order-systemmvn clean installdocker-compose up -d oracle-db rabbitmqWait a few minutes for Oracle DB to be fully initialized.
Option A: With Docker Compose (Recommended)
docker-compose up -dOption B: Manually
# Service Discovery
cd service-discovery
mvn spring-boot:run
# Config Server (in another terminal)
cd config-server
mvn spring-boot:run
# User Service (in another terminal)
cd user-service
mvn spring-boot:run
# Product Service (in another terminal)
cd product-service
mvn spring-boot:run
# Order Service (in another terminal)
cd order-service
mvn spring-boot:run
# API Gateway (in another terminal)
cd api-gateway
mvn spring-boot:run- Eureka Dashboard: http://localhost:8761
- API Gateway: http://localhost:8080
- RabbitMQ Management: http://localhost:15672 (admin/admin123)
- User Service: http://localhost:8081
- Product Service: http://localhost:8082
- Order Service: http://localhost:8083
Once the services are started, access the Swagger documentation:
- User Service API: http://localhost:8080/user-service/swagger-ui.html
- Product Service API: http://localhost:8080/product-service/swagger-ui.html
- Order Service API: http://localhost:8080/order-service/swagger-ui.html
mvn clean testmvn clean verifymvn clean test jacoco:reportReports are generated in target/site/jacoco/index.html for each module.
spring-microservices-order-system/
├── api-gateway/ # Spring Cloud Gateway
├── service-discovery/ # Eureka Server
├── config-server/ # Spring Cloud Config
├── user-service/ # User microservice
├── product-service/ # Product microservice
├── order-service/ # Order microservice
├── common/ # Shared libraries
├── docker-compose.yml # Docker configuration
├── pom.xml # Parent POM
└── README.md
Default credentials:
- Host: localhost:1521
- SID: XEPDB1
- User: system
- Password: Oracle123
Default credentials:
- Host: localhost:5672
- User: admin
- Password: admin123
The project includes .gitignore files configured in:
- Project root: Global configuration for the entire monorepo
- Each microservice: Specific configuration for each module
The .gitignore files exclude:
- Maven build files (
target/,*.class) - IDE configuration files (
.idea/,*.iml,.vscode/) - Logs and temporary files (
*.log,*.tmp,*.bak) - Local configuration files (
application-local.yml) - Operating system files (
.DS_Store,Thumbs.db)
docker-compose logs oracle-db
docker-compose restart oracle-db# View processes using the port
netstat -ano | findstr :8080
# Change the port in application.yml or stop the process- Verify that Eureka is running at http://localhost:8761
- Check service logs
- Verify
eureka.client.serviceUrl.defaultZoneconfiguration
This project is licensed under the MIT License.
Contributions are welcome. Please:
- Fork the project
- Create a branch for your feature (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
For questions or suggestions, please open an issue in the repository.