How mploed/ddd-with-spring works
Main Components
• Assets Module – Acts as a web asset provider with static resources and a Spring Boot application (under the “assets” folder). It supports the presentation layer.
• Credit Agency – Implements a bounded context that handles credit agency functionalities. It includes event processing (incoming events like ApplicationSubmittedEvent) and messaging components. It connects to messaging channels and a repository for PersonRating data.
• Credit Sales Funnel – Responsible for handling credit sales aspects. It is a Spring Boot application with web controllers and templates (HTML pages) that provide the front-end for credit applications. It interacts with domain models such as CreditApplicationForm and related applicant, household, financing, and real estate entities.
• Scoring – The largest module, which is organized into several submodules (adapters-input, adapters-output, aggregates, application-services, microarchitecture, scoring-application, and sharedmodel). This module is responsible for processing scoring events and implementing the scoring business logic using event-based communication, domain aggregates, and application services.
• Infrastructure Components – There are Dockerfiles for several modules (credit-agency, credit-sales-funnel, scoring, and infrastructure_varnish) and a docker-compose file orchestrates their startup. The “infrastructure_varnish” folder indicates a reverse proxy or caching layer.
• External Services – Messaging systems (like RabbitMQ implied by the use of Spring Cloud Stream and message channels), databases (used via Spring Data JPA), and possibly HTTP feeds.
Relationships and Interactions
• Communication between bounded contexts is event driven. For example, credit agency and scoring modules communicate through domain events (e.g., ApplicationSubmittedEvent, AgencyResultArrivedEvent).
• Use of Spring Cloud Stream suggests asynchronous messaging, so include message brokers and channels showing inputs and outputs.
• The scoring module has clearly isolated input and output adapters along with internal aggregates. It processes incoming messages from credit agency or credit sales funnel and produces scoring results.
• The credit sales funnel includes web controllers and templates; thus, it is likely interfacing directly with end-users via HTTP, and it may push domain events downstream.
• Docker containers and docker-compose are being used to orchestrate the services. Varnish likely sits as an edge infrastructure component to route or cache incoming requests.
Architectural Patterns and Design Principles
• Domain-Driven Design – Separate bounded contexts (credit-agency, credit-sales-funnel, scoring) with their aggregates and domain events.
• Hexagonal/Ports & Adapters – Visible in the scoring module by the clear separation between adapters (input/output), application services, and the domain (aggregates).
• Event-Based Communication – Both through messaging channels (using Spring Cloud Stream) and Spring Application Events.
• Microservices/Modular Monolith – Although deployed via Docker, the modules are separated into dedicated subprojects which can run independently.