@PostMapping: 주어진 URI 표현식과 일치하는 HTTP POST 요청을 처리.
클래스 레벨에 매핑 정보를 두면 메서드 레벨에서 해당 정보를 조합해서 사용
@RestController
@RequestMapping("/mapping/users")
public class MappingClassController {
@GetMapping
public String user() {
return "get users";
}
@PostMapping
public String addUser() {
return "add user";
}
@GetMapping("/{userId}")
public String findUser(@PathVariable String userId) {
return "get userId= " + userId;
}
@PatchMapping("/{userId}")
public String updateUser(@PathVariable String userId) {
return "update userId= " + userId;
}
@DeleteMapping("/{userId}")
public String deleteUser(@PathVariable String userId) {
return "delete userId= " + userId;
}
}