This is my first project using Spring Boot. The main objective of this repository is to establish a Spring Boot application, explore its foundational structure, and develop a simple Student Management API. The project demonstrates how to implement basic CRUD operations for managing student data. Additionally, it provides a step-by-step guide for setting up a development environment in VS Code for Spring Boot development.
- This project demonstrates how to create a basic Spring Boot application.
- It includes a simple controller (
AppController) that defines various endpoints for student management. - The application supports CRUD operations for students, such as adding, updating, retrieving, and deleting students.
- Helps others learn how to set up VS Code for Spring Boot projects.
- GET /app/student - Returns a single hardcoded student (Bob).
- GET /app/all-students - Returns a list of all students.
- GET /app/student/{regno} - Returns a student by their registration number.
- GET /app/student/by-age - Returns students whose age is between 20 and 23.
- GET /app/order/all-students - Returns all students sorted by GPA in descending order.
- POST /app/student/add - Adds a new student.
- PUT /app/student/update/{regno} - Updates an existing student's information by registration number.
- DELETE /app/student/delete/{regno} - Deletes a student by registration number.
- Spring Boot
- Java
- VS Code
- Maven for build automation
src/
├── main/
│ ├── java/lk/ac/vau/fas/ict/first/Controller/AppController.java # Main controller with all endpoints
│ ├── java/lk/ac/vau/fas/ict/first/Model/Student.java # Model class for student data
│ ├── resources/
│ │ ├── application.properties
├── pom.xml # Maven project configuration file
├── README.md # Project documentation
-
Clone the Repository
git clone https://github.com/LayuruLK/IT3232---SpringBoot-First-Project cd first-springboot-project -
Open the Project in VS Code
- Install the Spring Boot Extension Pack from the VS Code Marketplace.
- Ensure you have Java and Maven installed.
-
Run the Application
mvn spring-boot:run
-
Access the Endpoints Open your browser and visit the following endpoints:
- http://localhost:8080/app/msg → Displays "Hello SpringBoot"
- http://localhost:8080/app/name → Displays "My name is SpringBoot"
- http://localhost:8080/app/student → Returns the student Bob
- http://localhost:8080/app/all-students → Returns all students
- http://localhost:8080/app/student/{regno} → Returns a student by their registration number
- http://localhost:8080/app/student/by-age → Returns students between the age of 20 and 23
- http://localhost:8080/app/order/all-students → Returns students sorted by GPA
- http://localhost:8080/app/student/delete/{regno} → Delete student by Registration number
- http://localhost:8080/app/student/update/{regno} → Update student by Registration number
- http://localhost:8080/app/student/add → Add New Student
This project serves as an excellent foundation for anyone getting started with Spring Boot. It provides a clear and hands-on approach to understanding key concepts such as setting up a Spring Boot application, creating RESTful APIs, and performing basic CRUD (Create, Read, Update, Delete) operations. With a simple student database, this project demonstrates how to manage data, handle HTTP requests, and implement dynamic endpoints. Whether you're new to Spring Boot or looking to reinforce your skills, this project offers valuable insights into building efficient, maintainable backend applications.
This project is open-source and available for learning purposes.











