I have recently started learning spring boot and when I am trying to pass id or age in postman to test it I am getting value as 1 for id and 25 for age (I have declared id and age as Integers in method parameter).
Here is a code from controller
@RestController
@RequestMapping("/student/")
public class StudentController {
@GetMapping()
public Integer getStudents( @RequestParam() Integer id,@RequestParam() Integer age ){
return age;
}
Here is the screenshot from postman
When I declare id and age as Strings in method params The results are 1,value
for id and 25,value
for age .
For all the other queryparams the reults are as expected .
What is the reason for this? How does spring convert types?
Any help is appreciated . Thank you .