How mekni-aymen/price-microservice works
Project type and purpose
• This is a standalone Spring Boot microservice named “Intervista” that manages price data via a REST API.
• It follows a Hexagonal (Ports & Adapters) architecture to isolate business logic from I/O and make it easily testable and extensible.
File structure
• Top-level: a Maven project under intervista/intervista with standard pom.xml, wrapper scripts and .mvn.
• src/main/java/com/example/intervista contains three main layers:
• domain/model & domain/port
• application (use-case layer)
• infrastructure/adapters, which subdivides into:
– entities
– exception
– persistence (JPA adapters)
– rest (HTTP inbound adapter)
– conf (DataInitializer)
• src/main/resources holds application.properties (H2 DB config) and data.sql.
• Tests mirror the same layers under src/test/java.
README for additional insights
• It explicitly calls out Hexagonal architecture:
• domain (core business rules)
• application (use-cases)
• infrastructure (inbound and outbound adapters)
• The README even shows how adding MongoDB only requires changes in infrastructure (new Mongo adapters), leaving domain and application untouched.
Detail
• Classes by package but show each package as a separate component
• Configuration components (DataInitializer) and exception handlers
• Call out optional branches (Mongo) to demonstrate the extend-without-change benefit of Hexagonal