A RESTful API built with Java and Spring Boot for managing cloud vendor service information. Supports full CRUD operations with structured exception handling and a clean layered architecture.
- Java 17
- Spring Boot
- MySQL (MySQL Workbench)
- Maven
The project follows a layered architecture pattern:
- Controller Layer – Handles HTTP requests and responses
- Service Layer – Business logic via interface + implementation
- Repository Layer – Database access using Spring Data JPA
- Exception Layer – Custom exceptions with global exception handler
- Response Handler – Standardized API response structure
| Method | Endpoint | Description |
|---|---|---|
| GET | /cloudvendor | Get all cloud vendors |
| GET | /cloudvendor/{id} | Get vendor by ID |
| POST | /cloudvendor | Add new cloud vendor |
| PUT | /cloudvendor/{id} | Update vendor details |
| DELETE | /cloudvendor/{id} | Delete a cloud vendor |
src/
├── controller/
│ └── CloudVendorController.java
├── service/
│ ├── CloudVendorService.java # Interface
│ └── impl/
│ └── CloudVendorServiceImpl.java # Implementation
├── model/
│ └── CloudVendor.java
├── exception/
│ ├── CloudVendorException.java
│ ├── CloudVendorNotFoundException.java
│ └── CloudVendorExceptionHandler.java
└── Response/
└── ResponseHandler.java
-
Clone the repository git clone https://github.com/Kainat90/restdemo.git
-
Create a MySQL database CREATE DATABASE restdemo;
-
Update application.properties spring.datasource.url=jdbc:mysql://localhost:3306/restdemo spring.datasource.username= root spring.datasource.password= winter
-
Run the application ./mvnw spring-boot:run
-
API is available at http://localhost:8080
- Designing RESTful APIs with Spring Boot
- Layered architecture (Controller → Service → Repository)
- Custom exception handling with @ControllerAdvice
- Database integration with Spring Data JPA and MySQL
- Clean code practices with interface-based service design