package com.example.controller; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RestController; import com.example.model.SampleRequestModel; import com.example.model.SampleResponseModel; import com.example.service.SampleService; @RestController public class SampleController { @Autowired SampleService sampleService; @PostMapping(value = "/createSample", consumes = "application/json", produces = "application/json") public SampleResponseModel createSample(@RequestBody(required = false) SampleRequestModel SampleRequestModel) { return sampleService.createSample(SampleRequestModel); } }