This is a simple Spring Boot application that provides CRUD operations for managing Cloud Vendors. The application includes several best practices for logging, exception handling, testing, monitoring, and API documentation using Swagger.
The API supports the following operations:
- Create Cloud Vendor:
public String createCloudVendor(CloudVendor cloudVendor);
- Update Cloud Vendor:
public String updateCloudVendor(CloudVendor cloudVendor);
- Delete Cloud Vendor:
public String deleteCloudVendor(Integer cloudVendorId);
- Get Cloud Vendor by ID:
public CloudVendor getCloudVendorById(Integer cloudVendorId);
- Get All Cloud Vendors:
public List<CloudVendor> getAllCloudVendors();
- Added logging using SLF4J and Logback to keep track of application events and errors.
- Integrated Spring Boot Actuator for application monitoring.
- Added a custom actuator endpoint to expose specific application metrics.
- Implemented centralized exception handling to provide consistent and informative error responses.
- Added a custom response handler to standardize API responses.
- Conducted thorough testing of all logic using JUnit, Mockito, and AssertJ.
- Utilized H2 database for in-memory testing.
- All tests passed successfully.
- Integrated Swagger for API documentation with a custom configuration class.
- Java 17 or higher
- Maven 3.6.0 or higher
- Clone the repository:
git clone https://github.com/your-repo/cloudvendor-api.git cd cloudvendor-apimvn
- Build the project using Maven:
clean install Run the application mvn spring-boot:run
The API can be accessed via the following endpoints:
Create Cloud Vendor:
POST /api/cloudvendors
Update Cloud Vendor:
PUT /api/cloudvendors
Delete Cloud Vendor:
DELETE /api/cloudvendors/{id}
Get Cloud Vendor by ID:
GET /api/cloudvendors/{id}
Get All Cloud Vendors:
GET /api/cloudvendors
Access the Swagger UI to explore and test the API endpoints:
http://localhost:8080/swagger-ui.html (change the port accordingly)
http://localhost:8080/api-docs
-Access monitoring and custom actuator endpoints:
GET /actuator/health
GET /actuator/custom-endpoint
Contributions are welcome! Please create a pull request with your changes or open an issue for any bugs or feature requests.
This project is FREE for everyone