Spring MVC & REST
Fast recall
Quick revision
Core answer
Whether you understand the MVC separation of concerns, the role of DispatcherServlet in Spring MVC, and how @RestController differs from @Controller.
Putting business logic in controller methods, or not understanding that @RestController implies @ResponseBody for all methods.
Explain the request lifecycle in Spring MVC (DispatcherServlet -> HandlerMapping -> Controller -> ViewResolver or MessageConverter), and how content negotiation chooses JSON vs XML.
Interview-ready guide
Interview answer
A page controller can add OrderDto to Model and return a Thymeleaf view name. An API controller can return OrderDto from @RestController; MVC then chooses a converter for the negotiated media type. In both cases the controller should delegate business rules to an appropriate application/service boundary. MVC is a separation pattern, not a requirement to create an empty layer for every operation.
Spring MVC & REST
Direct Answer
MVC separates request coordination, application/domain work, and presentation. In Spring MVC, DispatcherServlet handles requests mapped to it, selects a handler, and then renders a view or writes a response body. It does not receive literally every HTTP request before filters or other servlets. @RestController applies response-body semantics, and converters—not the annotation itself—produce JSON, XML, text, or other supported formats.
Common Mistakes & Pitfalls
Putting business logic in controller methods, or not understanding that @RestController implies @ResponseBody for all methods.
Check your understanding
Answer these without looking back at the article.
- What is the role of DispatcherServlet in Spring MVC?
- How does @RestController differ from @Controller?
- What is the difference between @PathVariable and @RequestParam?
- How does content negotiation work in Spring REST?
- Why should controllers be thin and delegate to the service layer?
Looking for a structured roadmap?
Every module on this page is also part of the full Java backend interview track.