반응형

🧩 역할
URL경로에 포함된 값을 메서드 파라미터로 꺼내쓰게 도와주는 역할
🚀 특징
- 어노테이션에 명시한 파라미터 명과, 함수에서 명시한 파라미터이 일치해야함
@GetMapping("/posts/{postId}/comments/{commentId}")
fun getComment(
@PathVariable postId: Long?,
@PathVariable commentId: Long?): String
{
return postId.toString() + ", " + commentId
}
반응형
'Spring > 어노테이션' 카테고리의 다른 글
| Spring Boot Validation (0) | 2026.02.07 |
|---|---|
| RequestParam (0) | 2026.01.17 |
| Request 어노테이션 (0) | 2026.01.17 |
| @ResponseStatus (0) | 2026.01.10 |
| @ResponseBody (0) | 2025.12.21 |