@RestController
@RequestMapping("/api/users")
public class UserController {
\t@Autowired
\tprivate UserService userService;
\t@GetMapping
\tpublic List<User> getUsers() {
\t\treturn userService.getAllUsers();
\t}
\t@PostMapping
\tpublic User createUser(@RequestBody User user) {
\t\treturn userService.createUser(user);
\t}
\t@GetMapping("/{id}")
\tpublic User getUser(@PathVariable("id") int id) {
\t\treturn userService.getUserById(id);
\t}
\t@PutMapping("/{id}")
\tpublic User updateUser(@PathVariable("id") int id, @RequestBody User user) {
\t\treturn userService.updateUser(id, user);
\t}
\t@DeleteMapping("/{id}")
\tpublic void deleteUser(@PathVariable("id") int id) {
\t\tuserService.deleteUser(id);
\t}
}