'postman post request json payload created and in return , response is empty with respect to spring boot project

**** I have created repository and autowired that to service class and created controller and autowired the service and and the sample code below same code i have tried it for different project and it is working but in this seems to be an issue please someone help me solve this..**

Thank you.

payload request:

  {
     "name":"john",
     "gender":"male",
     "guardianName":"jackson"
  }

  the response 

  []

**Controller class **

  @RestController
  @RequestMapping("/patients")
  public class PatientsController {

    @Autowired
    private PatientsService patientsService;

    
    public PatientsController(PatientsService patientsService)
    {
        this.patientsService = patientsService;
    }
    
    @GetMapping
    public List<Patients> findAllPatients() {
        return patientsService.findAllPatients();
    }
    
    @GetMapping("/{id}")
    public Optional<Patients> findById(@PathVariable("id") Long id) {
        return patientsService.findById(id);
    }

    @PostMapping
    public Patients savePatient(@RequestBody Patients patients) {
        return patientsService.savePatients(patients);
    }

    @PutMapping
    public Patients updateEmployee(@RequestBody Patients patients`enter code here`) {
        return patientsService.updatePatients(patients);
    }

    @DeleteMapping("/{id}")
    public void deleteEmployee(@PathVariable("id") Long id) {
        patientsService.deleteEmployee(id);
      }
  }

domain simple pojo class

  @Entity
  @Table(name = "patient")
  public class Patients {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id")
    @NonNull
    private long id;
    
    @NonNull
    @Column(name = "name")
    private String name;
    
    @NonNull
    @Column(name = "gender")
    private String gender;
    
    @NonNull
    @Column(name = "guardian_Name")
    private String guardianName;
 
    public Patients() {
        // TODO Auto-generated constructor stub
    }
 
    public Patients(String name, String gender, String guardianName) {
        super();
        this.name = name;
        this.gender = gender;
        this.guardianName = guardianName;
    }
 



**  


Solution 1:[1]

I got the answer for the above problem its nothing but in entity class forgot to add the "to String" method and parameter constructor

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Shreyas Shashi