@ResponseBody
- 참고로 @RestController를 사용할 시 모든 메서드에 @ResponseBody 자동으로 붙여줌.
@ResponseEntity
- 응답 보낼 때 헤더 및 상태 코드 직접적으로 다룰 때 사용함.
Web on Servlet Stack
This part of the reference documentation covers support for Servlet stack, WebSocket messaging that includes raw WebSocket interactions, WebSocket emulation through SockJS, and publish-subscribe messaging through STOMP as a sub-protocol over WebSocket. 4.1
docs.spring.io
[Spring] @ResponseEntity가 뭘까? @ResponseBody와 차이점?
@ResponseBody @ResponseBody 는 핸들러 메소드에 붙일 수 있는 어노테이션으로 컨트롤러가 데이터를 반환할 때 HttpMessageConverter 를 사용해서 자바 객체를 응답 본문(body) 메시지를 만들어 반환할 수 있게
dev-coco.tistory.com
[Spring MVC] @ResponseBody와 ResponseEntity
@ResponseBody @ResponseBody는 핸들러 메서드에 붙일 수 있는 애노테이션으로 HttpMessageConverter를 사용해 응답 본문(body) 메시지로 보낼 때 사용할 수 있다. 그러나 @RestController를 사용하면 그 Class안..
hooongs.tistory.com
'개발 > java' 카테고리의 다른 글
@bean vs @component (0) | 2022.10.27 |
---|---|
java. incompatible types: int cannot be converted to java.lang.String(String 변수에 int형의 값을 넣으려고 하는 경우) (0) | 2022.08.31 |
spring. 정적 컨텐츠 (0) | 2022.03.23 |
intellij. 파일 목록 멀티 라인으로 표기 (0) | 2022.01.12 |
java. s3 업로드 / 이미지 리사이즈 (0) | 2022.01.11 |