This is a Spring Boot project that demonstrates basic CRUD (Create, Read, Update, Delete) operations with a RESTful API. The project is built using Spring Boot, Spring Data JPA, and a MySQL database (or any other database as per your configuration).
- Create: Add new records to the database.
- Read: Fetch single or multiple records.
- Update: Modify existing records.
- Delete: Remove records from the database.
- Cross-Origin Resource Sharing (CORS) enabled for frontend communication.
Java 17: The programming language used for the backend.
Spring Boot: For creating the RESTful API.
Spring Data JPA: For interacting with the database.
MySQL: The database used for storing data (configurable).
Maven: For managing project dependencies.
Clone the repository:
https://github.com/sandundil2002/Springboot_CRUD.git
cd Springboot_CRUDConfigure the Database:
spring.datasource.url=jdbc:mysql://localhost:3306/your_database_name
spring.datasource.username=your_username
spring.datasource.password=your_password
spring.jpa.hibernate.ddl-auto=updateBuild & Run the project:
mvn clean install
mvn spring-boot:runThe application will start on http://localhost:8080.
GET "/blog/getAllBlog"GET "/blog/getBlog?id=1"| Parameter | Type | Description |
|---|---|---|
id |
int |
Required. Id of blog to fetch |
POST "/blog/saveBlog"
{
"title": "Main",
"content": "Test"
}PUT "/blog/updateBlog"
{
"title": "Main",
"content": "Updated"
}DELETE "/blog/deleteBlog?id=1"| Parameter | Type | Description |
|---|---|---|
id |
int |
Required. Id of blog to delete |
Contributions are always welcome!
Please submit a pull request or open an issue to discuss your ideas.
