// [Request sample]
// POST http://localhost:8080/hello/request/form/model
// Header
// Content type: application/x-www-form-urlencoded
// Body
// name=BTS&age=28
@PostMapping("/form/model")
@ResponseBody
public String helloRequestBodyForm(@ModelAttribute Star star) {
return String.format("Hello, @RequestBody.<br> (name = %s, age = %d) ", star.name, star.age);
}
modelAttribute 로 선언한 객체에는 @Setter를 선언이 필요하다.
@RequestBody는 생략이 불가능하고 application/json을 받기 위해서는
@RequestBody를 반드시 사용해야한다.