Overview
The Spring Boot Student Info Management API is a RESTful API designed to manage student data efficiently.
This project leverages Spring Boot and MySQL to provide a robust backend for CRUD operations on student records.
Project Structure
- Controller: Manages API endpoints and requests.
- Entity: Defines the Student model.
- Repository: Interfaces with the database.
- Application: Main entry point of the Spring Boot application.
Database Setup
Database Name: springboot_rest
Table Name: Student
Columns:
id (INT): Primary key, unique identifier for each student.
student_name (VARCHAR): Name of the student.
student_email (VARCHAR): Email of the student.
student_address (VARCHAR): Address of the student.
Features
Create: Add new student records.
Read: Retrieve details of students or list all students.
Update: Modify existing student records.
Delete: Remove student records by ID.
Spring Boot Framework: Utilizes Spring Boot for rapid development and easy configuration.
MySQL Integration: Connects to a MySQL database for persistent storage.
RESTful API: Provides clean and standardized API endpoints.
API Endpoints
POST /api/students: Create a new student record.
GET /api/students: Retrieve a list of all students.
GET /api/students/{id}: Retrieve a specific student by ID.
PUT /api/students/{id}: Update an existing student record by ID.
DELETE /api/students/{id}: Delete a student record by ID.
Example Requests
Create a Student
POST /api/students
Content-Type: application/json
{
"studentName": "John Doe",
"studentEmail": "[email protected]",
"studentAddress": "123 Main St"
}
Get All Students
GET /api/students
Get Student by ID
GET /api/students/1
Update Student
PUT /api/students/1
Content-Type: application/json
{ "studentName": "Jane Doe", "studentEmail": "[email protected]", "studentAddress": "456 Elm St" }
Delete Student
DELETE /api/students/1
Tools and Technologies Used
Java: The primary programming language used.
Maven: For managing project dependencies and building the project.
JDBC: For database connectivity.
MySQL: Database used to store student records.
Apache Tomcat: Server used to deploy the REST API.
Postman: For testing the API endpoints.
Eclipse IDE: Integrated development environment used for coding and debugging.
Spring Initializr Dependencies:
-Spring Web: Build web applications, including RESTful services, using Spring MVC. Uses Apache Tomcat as the default embedded container.
-Spring Boot DevTools: Provides fast application restarts, LiveReload, and configurations for an enhanced development experience.
-Spring Data JPA: Persist data in SQL stores with Java Persistence API using Spring Data and Hibernate.
-MySQL Driver: JDBC driver for MySQL.