Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions Springboot/Springboot/.mvn/wrapper/maven-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
wrapperVersion=3.3.2
distributionType=only-script
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.11/apache-maven-3.9.11-bin.zip
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,15 @@
@RequestMapping("/api") // All endpoints will start with /api
public class StudentController {


@Autowired
private final StudentService studentService;



// Constructor Injection (best practice)
@Autowired


public StudentController(StudentService studentService) {
this.studentService = studentService;
}
Expand All @@ -43,7 +48,7 @@ public Optional<Student> getStudentById(@PathVariable Long id) {
// POST /api/students → Add new student
@PostMapping("/students")
public Student addStudent(@RequestBody Student student) {
return studentService.addStudent(student);
return studentService.addStudent(studentService.addStudent(student));
}

// PUT /api/students/{id} → Update student
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import com.program.Springboot.model.Student;


public interface StudentService {

// GET: /students
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
import com.program.Springboot.model.Student;
import com.program.Springboot.service.StudentService;

public class StudentServiceImpl extends StudentService {
@Service
public class StudentServiceImpl implements StudentService {

// Simulated database (key = pkStudentID, value = Student object)
private final Map<Long, Student> studentDB = new HashMap<>();
Expand All @@ -30,7 +31,9 @@ public Optional<Student> getStudentById(Long id) {

@Override
public Student addStudent(Student student) {
// store student using their ID as the key


studentDB.put(student.getPkStudentID(), student);
return student;
}

Expand All @@ -54,9 +57,9 @@ public Student updateStudent(Long id, Student updatedStudent) {
public boolean deleteStudent(Long id) {
if (studentDB.containsKey(id)) {
studentDB.remove(id);
return false;
return true;
}
return true;
return false;
}

}
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration
spring.application.name=Springboot
server.port = 9O90
server.port = 9090
3 changes: 2 additions & 1 deletion Springboot/Springboot/target/classes/application.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration
spring.application.name=Springboot
server.port = 9O90
server.port = 9090
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
com\program\Springboot\service\impl\StudentServiceImpl.class
com\program\Springboot\SpringbootApplication.class
com\program\Springboot\model\Student.class
com\program\Springboot\service\StudentService.class
com\program\Springboot\controller\StudentController.class
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
C:\Users\Rafael\Downloads\Springboot\Springboot\src\main\java\com\program\Springboot\controller\StudentController.java
C:\Users\Rafael\Downloads\Springboot\Springboot\src\main\java\com\program\Springboot\model\Student.java
C:\Users\Rafael\Downloads\Springboot\Springboot\src\main\java\com\program\Springboot\service\impl\StudentServiceImpl.java
C:\Users\Rafael\Downloads\Springboot\Springboot\src\main\java\com\program\Springboot\service\StudentService.java
C:\Users\Rafael\Downloads\Springboot\Springboot\src\main\java\com\program\Springboot\SpringbootApplication.java
Z:\HH902\java-springboot-debugging\Springboot\Springboot\src\main\java\com\program\Springboot\controller\StudentController.java
Z:\HH902\java-springboot-debugging\Springboot\Springboot\src\main\java\com\program\Springboot\model\Student.java
Z:\HH902\java-springboot-debugging\Springboot\Springboot\src\main\java\com\program\Springboot\service\impl\StudentServiceImpl.java
Z:\HH902\java-springboot-debugging\Springboot\Springboot\src\main\java\com\program\Springboot\service\StudentService.java
Z:\HH902\java-springboot-debugging\Springboot\Springboot\src\main\java\com\program\Springboot\SpringbootApplication.java
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
com\program\Springboot\SpringbootApplicationTests.class
Original file line number Diff line number Diff line change
@@ -1 +1 @@
C:\Users\Rafael\Downloads\Springboot\Springboot\src\test\java\com\program\Springboot\SpringbootApplicationTests.java
Z:\HH902\java-springboot-debugging\Springboot\Springboot\src\test\java\com\program\Springboot\SpringbootApplicationTests.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Created at 2025-08-30T20:30:43.947
Boot Manifest-JAR contains absolute paths in classpath 'Z:\HH902\java-springboot-debugging\Springboot\Springboot\target\test-classes'
Hint: <argLine>-Djdk.net.URLClassPath.disableClassPathURLCheck=true</argLine>
'other' has different root

Loading