How gdiael/jbank works
1. Overall shape
- jbank is a small Spring Boot / Java 17 application organized as a layered domain app: adapter → service → repository → model.
- The package names suggest a light hexagonal/clean architecture style, even though the codebase is compact.
2. Runtime entry points
- com.ufrn.jbank.JbankApplication is the Spring Boot bootstrap class and the main application boundary.
- com.ufrn.jbank.adapter.MainCli indicates the primary user-facing entry point is a CLI, not a web UI or REST API.
3. Adapter layer
- adapter/AccountLoader and adapter/MainCli form the outer layer that handles interaction with the outside world.
- AccountLoader likely populates the system with initial account data, while MainCli likely parses commands and invokes application services.
4. Domain model
- model/Account is the core domain abstraction.
- model/SavingsAccount and model/BonusAccount are concrete account variants, implying business rules differ by account type.
- The model package is the central business boundary and should remain independent of CLI or persistence concerns.
5. Application services
- service/AccountService is the main orchestration layer for account-related use cases.
- service/BonusCalculatorService is a focused domain service for calculating bonuses, likely used by AccountService and/or account subtypes.
- Business rules appear to live here rather than in the CLI or repository.
6. Repository boundary
- repository/AccountRepository is the persistence abstraction for accounts.
- Because there is only one repository interface/file, the storage mechanism is probably simple and localized rather than a full database-centric architecture.
- The repository sits behind services, so the domain and CLI should not depend directly on storage details.
7. Main data flow
- Typical flow is: CLI input → MainCli → AccountService → AccountRepository / BonusCalculatorService → domain model.
- AccountLoader likely feeds startup or test data into the same service/repository path.
- This keeps command handling separate from business logic and persistence.
8. Business specialization
- The presence of both SavingsAccount and BonusAccount suggests different account behaviors are modeled explicitly rather than with flags.
- BonusCalculatorService likely encapsulates cross-cutting calculation logic instead of duplicating it across account classes.
9. Configuration and packaging
- src/main/resources/application.properties contains Spring Boot runtime configuration.
- There are no visible infrastructure integrations such as databases, message brokers, or external APIs in the tree, so the architecture appears self-contained.
10. Build and execution
- The project uses Maven with the wrapper (mvnw), which makes the build reproducible.
- Execution is via spring-boot:run, confirming this is a standard Spring Boot application.
11. Testing
- src/test/java/.../JbankApplicationTests.java is present, indicating at least a Spring Boot smoke/integration test baseline.
- The test footprint is small, which suggests the architecture is currently focused on core application structure rather than broad automated coverage.
12. Diagram takeaway
- When drawing the architecture, show a central domain/service core with a CLI adapter on one side and a repository boundary on the other.
- AccountLoader is best treated as a supporting adapter for initial data setup, while BonusCalculatorService is a domain service supporting account behavior.
Main entry points: AccountService.java Account Service · JbankApplication.java Jbank App · Account.java Account · MainCli.java Main CLI
Components 10
Bootstrap
Application entry points and startup boundary
- Jbank App · Main Spring Boot application bootstrap
jbank/src/main/java/com/ufrn/jbank/JbankApplication.java
Adapters
CLI and startup data ingestion
- Main CLI · Primary command-line user interface
jbank/src/main/java/com/ufrn/jbank/adapter/MainCli.java - Account Loader · Loads initial account data through the application flow
jbank/src/main/java/com/ufrn/jbank/adapter/AccountLoader.java
Domain
Core account model and variants
Services
Use-case orchestration and business rules
- Account Service · Coordinates account use cases
jbank/src/main/java/com/ufrn/jbank/service/AccountService.java - Bonus Calc · Calculates account bonuses
jbank/src/main/java/com/ufrn/jbank/service/BonusCalculatorService.java
Repository
Persistence boundary
- Account Repo · Persistence abstraction for accounts
jbank/src/main/java/com/ufrn/jbank/repository/AccountRepository.java
Config
Spring Boot runtime configuration
- App Config · Spring Boot application properties
jbank/src/main/resources/application.properties
Connections 11
- Main CLI → Account Service: invokes · CLI routes commands into application use cases
- Account Loader → Account Service: loads via · Startup data uses the same account workflow
- Account Service → Account Repo: persists through · Service depends on the repository boundary
- Account Service → Bonus Calc: calculates with · Service delegates bonus logic to a dedicated calculator
- Account Service → Account: operates on · Use cases work with the core account model
- Bonus Calc → Bonus: supports · Bonus calculation is tied to bonus account behavior
- Savings → Account: extends · Savings account specializes the base account model
- Bonus → Account: extends · Bonus account specializes the base account model
- Jbank App → Main CLI: starts · Spring Boot boots the command-line adapter
- Jbank App → Account Loader: initializes · Application startup can wire initial data loading
- Jbank App → App Config: reads · Runtime configuration is loaded at startup