How josebc377/plataformahotel works
Project Type and Purpose
• This is a Spring Boot–based, monolithic RESTful backend (“PlataformaHotel”) that exposes CRUD operations for hotel resources (rooms, categories, reservations, payments, reviews, users, etc.).
• It follows a classic layered architecture (Controller → Service → Repository → Database).
Main Components
a. Presentation Layer
– HTTP/REST interface provided by Spring MVC controllers under controllers/
– Endpoints: /categorias, /habitaciones, /reservas, /pagos, /resenas, /servicios, /usuarios, plus a global exception handler.
b. Business Logic Layer
– Service classes under services/ implement core domain workflows (e.g., creating reservations, processing payments).
c. Data Access Layer
– Spring Data JPA repositories under repositories/, each exposing CRUD methods for the corresponding entity.
d. Domain Model
– JPA entities under entities/ (e.g., Habitacion, Reserva, Pago, Usuario, etc.) map to relational tables.
e. Infrastructure
– HotelApplication.java bootstraps the application.
– application.properties configures the datasource (MySQL/H2), JPA settings, server port, etc.
– Maven build (pom.xml) and wrapper files (mvnw, .mvn/) manage lifecycle and dependencies.
External Dependencies & Tools
• Spring Boot, Spring MVC, Spring Data JPA, Hibernate
• Relational DB (MySQL, PostgreSQL or H2 for tests)
• JUnit/Mockito for unit and integration tests under src/test/
• Maven for build, dependency management, and test execution
Architectural Patterns & Principles
• Layered (n-tier) design: clear separation between API (controllers), domain logic (services), and persistence (repositories/entities).
• Dependency Injection via Spring Framework.
• Exception handling centralized with GlobalExceptionHandler.
• Repository pattern with Spring Data JPA.