我无法使用 SpringBoot 应用程序将现有的 REST 控制器转换为 Ratpack 处理程序。
请任何人帮助我完成这项工作。下面是我的控制器类:
@RestController
@RequestMapping("/api")
public class RestApiController {
public static final Logger logger = LoggerFactory.getLogger(RestApiController.class);
@Autowired
private EmployeeService EmployeeService;
/**
* Service will retrieve data for particular Employee
*
* @param id Employee Id
* @return ResponseEntity of Employee
*/
@GetMapping(value = "/Employee/{id}")
public Employee getEmployee(@PathVariable("id") String id) {
logger.info("Fetching Employee with id {}", id);
return EmployeeService.findById(id);
}
/**
* Service will create Employee data into the System
*
* @param Employee Data of the Employee
* @param UriComponentsBuilder
* @return ResponseEntity of String
*/
@PostMapping(value = "/Employee/")
public void createEmployee(@RequestBody Employee Employee) {
logger.info("Creating Employee : {}", Employee);
EmployeeService.saveEmployee(Employee);
}
}