Building a Bookstore with Java Spring Boot and MySQL: Features, Guide, and Insights
Bookstore with Java Spring Boot and MySQL
Overview
Bookstore with Java Spring Boot and MySQL is a robust and user-friendly Java Spring Boot application designed for managing and selling books. It organizes books into various categories and streamlines their addition, sale, and record management.
Download New Real Time Projects :-Click here
Project Details
Project Name | BookStore |
---|---|
Language | Java |
Framework | Spring Boot |
Database | MySQL |
Developer | updategadh.com |
Categories Supported
- LITERATURE
- NONFICTION
- ACTION
- THRILLER
- TECHNOLOGY
- DRAMA
- POETRY
- MEDIA
- OTHERS
Database Details
The application uses a MySQL database named bookstore, which contains a single table, book. The table includes the following columns:
Column Name | Description |
---|---|
id | Unique identifier for each book |
author | Author of the book |
title | Title of the book |
category | Book category (enum-based) |
price | Price of the book |
total_count | Total number of copies available |
sold | Number of copies sold |
Key Features
1. Book Addition
- Add New Book: Register a book that’s not already in the system with endpoint
/api/add-new-book
. - Add Copies to Existing Book: Update the inventory of an existing book with endpoint
/api/add-book
.
2. Fetch Book Details
- Get Book by ID: Retrieve book details by its ID with endpoint
/api/book/{id}
. - Get All Books: List all registered books via
/api/book-list
. - Get Number of Books Available by ID: Use
/api/number-of-books/{id}
to find the available count.
3. Update Book Details
Update book information using the endpoint /api/books/{id}
.
4. Selling Books
- Sell a Single Book: Endpoint
/api/sell-book/{id}
sells one copy of a book by its ID. - Sell Multiple Books: Use
/api/sell-books
to process multiple book sales.
5. Advanced Search
- Search by Category and Keyword:
/api/books?keyword=keyword&category=category
searches books based on category and keyword. - Get Sales Data:
/api/number-of-books?keyword=keyword&category=category
retrieves the number of books sold per category.
Tools and Frameworks
Tool/Framework | Purpose |
---|---|
MySQL | Relational database for data storage |
JPA/Hibernate | ORM for database communication |
JUnit/Mockito | Unit testing frameworks used in the controller and service layers |
Jacoco | Code coverage tool for generating test reports |
Lombok | Simplifies Java code with annotations for Getters, Setters, and Constructors |
ModelMapper | Object mapping tool for simplifying object conversions |
Swagger | API documentation and testing framework |
Steps to Run the Application
- Set Up the Environment:
- Ensure MySQL is installed.
- Create a database named
bookstore
.
- Configure Database:
- Modify the
application.yaml
file to match your MySQLusername
,password
, anddatasource
URL. - Example configuration:
spring: datasource: url: jdbc:mysql://localhost:3306/bookstore username: root password: admin
- Modify the
- Install Lombok Plugin:
- If your IDE doesn’t have Lombok, install the plugin.
- Run the Application:
- The table book will be created automatically.
- Default port:
9999
. - Access the Swagger UI at
http://localhost:9999/swagger-ui.html
.
- Run Tests:
- Execute unit tests with
mvn clean test
. - Generate code coverage report using
mvn jacoco:report
.
- Execute unit tests with
Complete Advance AI topics:- CLICK HERE
Complete Python Course with Advance topics:-Click here
bookstore with java spring boot github
bookstore with java spring boot pdf
bookstore with java spring boot example
free bookstore with java spring boot
online bookstore with java spring boot
online book store using spring boot github
online book store project in java with source code
spring initializr
Post Comment