๐จ Hotel Management System
A Spring Bootโbased Hotel Management System that provides REST APIs to manage hotel information. The application follows a clean layered architecture using Controller, Service, Entity, and DTO patterns and demonstrates inter-service communication using RestTemplate.
๐ Features
- Create and fetch hotel details
- Update hotel address using DTO
- RESTful APIs with clean request and response handling
- Uses DTO pattern to avoid exposing entity directly
- Demonstrates inter-service communication using RestTemplate
- Clean and maintainable layered architecture
๐ Tech Stack
- Language: Java
- Framework: Spring Boot
- Architecture: REST APIs, ControllerโService pattern
- Concepts: OOPs, DTO Pattern, Dependency Injection
- Communication: RestTemplate
๐ Project Structure
src/main/java
โโโ controller
โ โโโ HotelController.java
โโโ service
โ โโโ HotelService.java
โโโ dto
โ โโโ HotelDTO.java
โ โโโ UpdateHotelAddressDTO.java
โโโ entity
โ โโโ Hotel.java
โโโ util
โ โโโ RestTemplateCommunicator.java
โโโ Application.java
๐ Application Flow
- Client sends HTTP request to HotelController
- Controller forwards request to HotelService
- Service layer processes business logic
- DTOs are used for request/response mapping
- Response is returned to client in JSON format
๐ฎ Sample API Endpoints
Create Hotel
POST /hotels
Get All Hotels
GET /hotels
Update Hotel Address
PUT /hotels/address
(Note: Endpoints may vary based on implementation)
๐ How to Run the Project
-
Clone the repository
-
Open the project in any Java IDE (IntelliJ / Eclipse / VS Code)
-
Ensure Java and Maven are installed
-
Run the application
mvn spring-boot:run
OR run the main application class directly from IDE
-
Test APIs using Postman
๐ฏ Learning Outcomes
- Strong understanding of Spring Boot REST APIs
- Practical usage of DTO pattern
- Experience with layered backend architecture
- Understanding of RestTemplate for service communication
๐ Future Enhancements
- Add database integration using JPA and MySQL
- Implement validation and exception handling
- Add Swagger for API documentation
- Secure APIs using Spring Security and JWT