I have a model class like this
package student;
import java.util.UUID;
public class Student {
private final UUID studentId;
private final String firstName;
private final String lastName;
private final String email;
private final Gender gender;
public Student(UUID studentId, String firstName, String lastName, String email, Gender gender) {
super();
this.studentId = studentId;
this.firstName = firstName;
this.lastName = lastName;
this.email = email;
this.gender = gender;
}
enum Gender {
MALE, FEMALE
}
}
I have RestController class like this
package student;
import java.util.List;
import java.util.UUID;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/students")
public class StudentController {
@GetMapping
public List<Student> getAllStudents() {
return List.of(
new Student(UUID.randomUUID(), "test", "test", "test", student.Student.Gender.MALE)
);
}
}
I am calling the endpoing with Postman like this:
And I am getting response like this
Please help me figure out what is causing the error