This is a simple bookstore web application developed using Spring Boot. It provides RESTful endpoints to perform CRUD operations on a collection of books stored in a MySQL database.
- View a list of books
- Add a new book
- Get details of a book by ID
- Update an existing book
- Delete a book
- Spring Boot
- Spring Data JPA
- MySQL
- Maven
- RESTful API
src/main/java: Contains Java source files for controllers, models, and repositories.src/main/resources: Containsapplication.propertiesfor configuration.pom.xml: Maven project configuration file.
Before running the application, ensure you have the following installed:
- Java Development Kit (JDK)
- MySQL Database Server
- Apache Maven
-
Database Configuration: Modify the database connection settings in
application.propertiesto match your MySQL database configuration.spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver spring.datasource.url=jdbc:mysql://localhost:3306/booksdb spring.datasource.username=your_username spring.datasource.password=your_password
Replace
your_usernameandyour_passwordwith your MySQL database username and password. -
Create Database: Create a MySQL database named
booksdb. -
Build Project: Build the project using Maven:
mvn clean install
-
Run the Application: Run the Spring Boot application using Maven:
mvn spring-boot:run
-
View Book List: Access the list of books by sending a GET request to
/books. -
Add New Book: Add a new book by sending a POST request to
/bookswith JSON payload containing book details. -
Get Book by ID: Get details of a book by sending a GET request to
/books/{id}where{id}is the book's ID. -
Update Book: Update an existing book by sending a PUT request to
/books/{id}with JSON payload containing updated book details. -
Delete Book: Delete a book by sending a DELETE request to
/books/{id}where{id}is the book's ID.
To contribute to the development of this project, follow these steps:
- Fork the repository.
- Create a new branch (
git checkout -b feature-branch). - Make your changes and commit them (
git commit -am 'Add new feature'). - Push your changes to the branch (
git push origin feature-branch). - Create a new Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.
Harshal Patil