A simple Spring Boot REST API for managing books, demonstrating:
- CRUD operations
- Pagination & Sorting
- H2 in-memory database
- Profiles (
@Profile
) - Bean qualification (
@Qualifier
) - Transaction management (
@Transactional
) - Scheduled tasks
- Custom configuration with
@Value
- RESTful design with Spring Web
- APIs on Swagger
- Postman Request
- Postman Request (for GET filter and pagination support: http://localhost:8080/books/page?page=0&size=5&sortBy=title)
- H2 DB console
- Java 17+
- Spring Boot 3.x
- Spring Web
- Spring Data JPA
- H2 Database
- Spring Profiles
- Lombok (optional)
- Springdoc OpenAPI (Swagger UI)
- @Transactional for atomic DB updates
- @Profile for environment-specific beans (dev / prod)
- @Qualifier to resolve multiple implementations
- @Scheduled for periodic tasks
- @Value, @PostConstruct, @PreDestroy for lifecycle & config
- H2 console: http://localhost:8080/h2-console
mvn spring-boot:run
Method Endpoint Description
- GET /books (Get all books)
- GET /books/{id} (Get book by ID)
- POST /books (Add new book)
- PUT /books/{id} (Update book by ID)
- DELETE /books/{id} (Delete book by ID)
- GET /books/page (Paginated books)
This project is licensed under the MIT License.
If you have some query, feel free to connect with me here -- Ranjan Kumar Mandal