package com.baeldung.webflux; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; @RestController @RequestMapping("/employees") public class EmployeeController { private EmployeeRepository employeeRepository; public EmployeeController(EmployeeRepository employeeRepository) { this.employeeRepository = employeeRepository; } @GetMapping("/{id}") private Mono getEmployeeById(@PathVariable String id) { return employeeRepository.findEmployeeById(id); } @GetMapping private Flux getAllEmployees() { return employeeRepository.findAllEmployees(); } @PostMapping("/update") private Mono updateEmployee(@RequestBody Employee employee) { return employeeRepository.updateEmployee(employee); } }