How anagonbu/app_cajero works
Components Identification
• Frontend/UI Layer:
• Represented by the Thymeleaf HTML templates located under the resources/templates folder (home.html, movimientos.html, operation.html, etc.).
• This layer handles user interaction (login, operation selection, form submissions for entering amounts, etc.).
• Web/Controller Layer:
• Includes the standard controllers (e.g., HomeController in cajeroweb/controller) and the REST controller (cajeroRestcontroller in cajeroweb/restontroller).
• This layer handles HTTP requests and manages session state (storing the current account number).
• Business Logic / Service Layer:
• These components handle validation (e.g., account existence, balance checks) and orchestrate transactions such as deposits, withdrawals, and transfers.
• Data Persistence Layer:
• The data access layer includes the DAO implementations (CuentaDaoImplJpaMy8, MovimientoDaoImplJpaMy8) and Spring Data JPA repository interfaces (CuentaRepository, MovimientoRepository).
• This layer maps the entities (Cuenta and Movimiento) to the underlying database (backed by cajero_2024.sql).
• Database:
• The underlying database is configured via the application.properties file and is prepped using the provided SQL script (cajero_2024.sql) to create the necessary tables.
Relationships and Interactions
• The UI layer interacts with the Controllers; when a user initiates an operation (e.g., deposit, withdrawal, transfer), the request is sent to the appropriate controller.
• Controllers call functions on the DAO/repository layer (either directly or via a subtly embedded business logic layer) to perform database operations.
• The DAOs and repositories then access the persistence layer, which reads from and writes to the database.
• In addition, session management is used to maintain the state of current account operations between HTTP requests.
Architectural Patterns and Key Design Principles
• MVC Pattern: The separation is clear between the Model (entities, DAO, repository), View (HTML templates), and Controller (web and REST controllers).
• Data Access using Spring Data JPA: Emphasizes CRUD operations on entities and handling persistence automatically.
• DAO Pattern: Custom DAO implementations (CuentaDaoImplJpaMy8, MovimientoDaoImplJpaMy8) possibly add additional business logic around data operations.
• Integration Points: Although no external services are directly shown, the design implies possible future integration with external banking services or logging if required.
Relevant Technologies and Frameworks
• Spring Boot: To develop the web application and manage dependency injection.
• Spring MVC: Underpins the Model-View-Controller architecture.
• Spring Data JPA: Simplifies the interaction with the relational database.
• Thymeleaf: Template engine for rendering HTML views.
• Maven: For build and dependency management (as seen with pom.xml, mvnw, and mvnw.cmd).