BE/Spring
[Spring] 초간단! 인자의 종류
Mingi Kim
2024. 2. 24. 14:31
본 포스팅은 메소드의 인자로 쓰이는 @PathVariable, @RequestParam, @RequestBody에 대해 다룹니다.
@PathVariable
@PathVariable은 URI Path로부터 값을 얻을 때 쓸 수 있습니다.
@RequestParam
- @RequestParam은 쿼리스트링으로부터 값을 얻을 때 쓸 수 있습니다.
- 내용 추가: Get method에서는 RequestBody로 인자를 받는 것이 허용되지 않음.
@RequestBody
@RequestBody는 JSON의 값을 인자로 받을 때, 사용합니다.