A Spring Boot REST API project for managing a library system. It provides full CRUD functionality for books, global exception handling, validation, and interactive API documentation using Swagger.
- Add, update, delete, and retrieve books
- Fetch book by ID
- Global exception handling (
@ControllerAdvice) - Input validation with meaningful error messages
- RESTful API design
- Swagger API documentation
- Layered architecture (Controller, Service, Repository)
- Java 17+
- Spring Boot
- Spring Web
- Spring Data JPA
- Hibernate
- Maven
- H2 / MySQL (based on configuration)
- Swagger / OpenAPI
Library-Management-System/
│
├── src/
│ ├── main/
│ │ ├── java/
│ │ │ └── com/library/demo/
│ │ │ ├── controller/
│ │ │ ├── service/
│ │ │ ├── repository/
│ │ │ ├── model/
│ │ │ ├── exception/
│ │ │ └── config/
│ │ └── resources/
│ │ ├── application.properties
│
├── pom.xml
├── mvnw
├── mvnw.cmd
└── README.md
git clone https://github.com/your-username/Library-Management-System.git
cd Library-Management-Systemmvn clean installmvn spring-boot:runBook APIs:
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/books | Get all books |
| GET | /api/books/{id} | Get book by ID |
| POST | /api/books | Add a new book |
| PUT | /api/books/{id} | Update book |
| DELETE | /api/books/{id} | Delete book |
Once the application is running, access API docs:
http://localhost:8080/swagger-ui/index.html
This project includes robust error handling for:
- Resource Not Found,
- Validation Errors,
- Generic Server Errors
All errors return structured and meaningful JSON responses.
Arpan Adhikari
- Washburn University
- Computer Information Science & Business Data Analytics