| Controller | HTTP Sample Request | ||
| 어노테이션 | 생략 | Sample Code | |
| @PathVariable | X | ![]() |
GET http://localhost:8080/hello/request/star/BTS/age/28 |
| @RequestParam | O | ![]() |
GET http://localhost:8080/hello/request/from/param?name=BTS&age=28 |
| O | ![]() |
POST http://localhost:8080/hello/request/form/param Header Content type: application/x-www.form-urlencoded Body name=BTS&age=28 |
|
| @ModelAttribute | O | ![]() |
POST http://localhost:8080/hello/request/form/model Header Content type: application/x-www.form-urlencoded Body name=BTS&age=28 |
| @RequestBody | X | ![]() |
POST http://localhost:8080/hello/request/form/json Header Content type: application/json Body {"name"=:"BTS", "age":"28"} |
@ModelAttribute로 선언한 객체에는 @Setter 선언 필요
'Spring > Springboot' 카테고리의 다른 글
| 스프링 빈 생명 주기(Spring Bean Life Cycle) (0) | 2022.11.08 |
|---|---|
| Controller, Service, Repository의 역할 (1) | 2022.11.08 |
| 빌드 관리 도구 Maven과 Gradle 비교 (0) | 2022.11.08 |
| AOP(Aspect-Oriented Programming) 관점 지향 프로그래밍 구현 (1) | 2022.11.08 |
| HTTP 메시지 이해 (0) | 2022.09.05 |




