In this Task , students will initialize a Spring Boot project, open it in IntelliJ, and create a simple user management system using a CommandLineRunner. The user management system will allow students to add, remove, and update student details via the command line. The student details will be stored in a List, and no database will be used.
Steps
Initialize the Spring Boot Project:
Go to Spring Initializer
Configure the project
Click Generate to download the project as a ZIP file.
Extract the ZIP file and open the project in IntelliJ IDEA.
Set Up the Project: Once the project is opened in IntelliJ, wait for the dependencies to load.
Create the Student Class:
create a new class called Student , This class should have the following attributes:
private Long id;
private String name;
private String email;
Add constructors, getters, setters, and a toString() method to the Student class.
Create the StudentServiceClass:
In the same package, create a new class called StudentService.
This class will manage the list of students and contain methods for adding, removing, updating, and listing students.
Implement the CommandLineRunner:
create class StudentManagementApplication, implement CommandLineRunner.
This will allow the application to run specific code after the Spring Boot application starts.
Run the Application:
Run the Spring Boot application from IntelliJ.
The application will start and prompt the user with the options to add, remove, update, or list students.
Students can interact with the application via the command line by selecting options and entering the required information.
If you encounter any issues, please feel free to inform me. Additionally, if you have any questions or concerns, do not hesitate to reach out.
For the following issue, please include the relevant code and provide screenshots demonstrating your interactions with the application. Specifically, show how you add students, update student details, and remove students from the list.
In this Task , students will initialize a Spring Boot project, open it in IntelliJ, and create a simple user management system using a
CommandLineRunner
. The user management system will allow students to add, remove, and update student details via the command line. The student details will be stored in aList
, and no database will be used.Steps
Create the Student Class:
Student
, This class should have the following attributes:toString()
method to theStudent
class.StudentService
Class:StudentService
.CommandLineRunner
:StudentManagementApplication
, implementCommandLineRunner
.If you encounter any issues, please feel free to inform me. Additionally, if you have any questions or concerns, do not hesitate to reach out.
For the following issue, please include the relevant code and provide screenshots demonstrating your interactions with the application. Specifically, show how you add students, update student details, and remove students from the list.
Thank you!