Issue
I have a system that uses Spring Boot in the server side. I'm getting an error that I can't see what is happening here.
That's my controller with the following end point:
@GetMapping("/api/getAge")
public int getAge (@RequestParam("person") Person p) {
return this.computeAge(p);
}
The method compute age returns (obviously) the person's age. The thing is: when I use postman to this route, the method runs but I get a http error 405.
Solution
You're missing the @ResponseBody
annotation:
@GetMapping("/api/getAge")
@ResponseBody
public int getAge (@RequestParam("person") Person p) {
return this.computeAge(p);
}
Answered By - André Pacheco
Answer Checked By - Cary Denson (JavaFixing Admin)