-
|
강의에서도 나왔지만, |
Beta Was this translation helpful? Give feedback.
Answered by
seyxxn
Jun 27, 2024
Replies: 1 comment 1 reply
-
|
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
6om1n
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@Controller와@RestController두 애노테이션 모두 스프링에서 컨트롤러의 역할을 지정해주기 위한 애노테이션
@Controller는 전통적인 SpringMVC의 컨트롤러@RestController는 RESTful 웹 서비스의 컨트롤러@controller
@Controller는 주로 View를 반환하기 위해 사용@ResponseBody를 사용해야 함@RestController
@RestController은@Controller와@ResponseBody의 조합차이점 정리
@Controller의 역할은 Model 객체를 만들어 데이터를 담고 View를 찾는 것이지만,@RestController는 단순히 객체만을 반환하고 객체 데이터는 JSON 또는 XML 형식으로 HTTP 응답에 담아서 전송