Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

컨트롤러의 리턴 타입이 ModelAndView가 아닐 경우, DispatcherServlet은 어떠한 처리 과정을 거치는가? #6

Open
great-park opened this issue Apr 20, 2023 · 3 comments
Labels
question Further information is requested

Comments

@great-park
Copy link
Member

great-park commented Apr 20, 2023

@controller의 실행 흐름
Client -> Dispatcher Servlet -> Handler Mapping -> Handler Adapter ->
Controller -> Handler Adapter -> Dispatcher Servlet -> ViewResolver -> -View >Client

@RestController의 실행 흐름
Client -> Dispatcher Servlet -> Handler Mapping -> Handler Adapter ->
RestController (자동 ResponseBody 추가)-> Handler Adapter -> Dispatcher Servlet -> HTTP Response -> Client

@great-park great-park added the question Further information is requested label Apr 20, 2023
@great-park great-park changed the title Spring MVC에서 컨트롤러의 리턴 타입이 ModelAndView가 아닐 경우, DispatcherServlet은 어떠한 처리 과정을 거치는가? 컨트롤러의 리턴 타입이 ModelAndView가 아닐 경우, DispatcherServlet은 어떠한 처리 과정을 거치는가? Apr 23, 2023
@great-park
Copy link
Member Author

@responsebody는 메소드가 반환하는 객체를 Http response body로 전송하도록 지정한다. 이때, Spring은 해당 객체를 Jackson 라이브러리를 사용하여 JSON 형태로 변환하여 Http response 패킷의 body에 넣는다.

@great-park
Copy link
Member Author

[ Controller로 View 반환하기 ]
image

[ Controller로 Data 반환하기 ]
image

@jeongyuneo
Copy link
Contributor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants