Inflearn Community Q&A
Formatter print 질문 드립니다.
Written on
·
222
0
Formatter parse 함수를 이용해서
컨트롤러로 요청이 들어오는 경우 자동으로 person으로 변환이 됐는데
@GetMapping("hello/{name}")
public String hello(@PathVariable("name") Person person) {
return
print 함수는 컨트롤러에서 어떻게 사용하는건가요?
혹시 샘플 코드가 있을까요?
감이 잘 안오네요 ^^;
MVCjavaspring
Answer 1
0
whiteship
Instructor
메소드 상단에 @ResponseBody를 추가하시구요. 메소드 리턴 타입에 String 대신에 Person으로 바꾸시고 저 메소드에서 person을 리턴하시면 포매터의 print가 사용됩니다.





