The problem is that when we use application/x-www-form-urlencoded, Spring doesn’t understand it as a RequestBody. So, if we want to use this
we must remove the @RequestBody annotation.
Then try the following:
@RequestMapping(value = "/patientdetails", method = RequestMethod.POST,consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE)
public @ResponseBody List<PatientProfileDto> getPatientDetails(
PatientProfileDto name) {
List<PatientProfileDto> list = new ArrayList<PatientProfileDto>();
list = service.getPatient(name);
return list;
}
Note that removed the annotation @RequestBody