Spring MVC Flow, DispatcherServlet, HandlerMapping HandlerAdapter | Spring Boot Interview Series #12

In this video, we will discuss Spring MVC Request Flow and DispatcherServlet. This is Video #12 of our Spring Boot Interview Series. In the previous videos, we completed the Spring Boot Fundamentals module. Now we are starting Module 3: Spring MVC and REST API Development. Before learning controller annotations, request body, response body, validation, and exception handling, it is important to understand how a request actually flows inside a Spring Boot REST API. When a client sends a request like: `GET /courses/101` Spring Boot does not directly call the controller method. The request first reaches the embedded server, then it is handled by Spring MVC through `DispatcherServlet`. Topics covered in this video: 1. What is Spring MVC and why do we use it? 2. What is DispatcherServlet? 3. Complete request flow in a Spring Boot REST API 4. Role of HandlerMapping and HandlerAdapter 5. Difference between `@Controller` and `@RestController` `DispatcherServlet` is known as the front controller of Spring MVC. It receives incoming HTTP requests and dispatches them to the correct controller method. In this video, we will also understand how components like `HandlerMapping` and `HandlerAdapter` help DispatcherServlet find and execute the correct controller method. We will explain the request flow using a simple REST API example: `GET /courses/101` The flow looks like this: Client Embedded Tomcat DispatcherServlet HandlerMapping Controller Service Repository Database JSON Response We will also discuss the difference between `@Controller` and `@RestController`. `@Controller` is mainly used when we want to return views or pages. `@RestController` is used when we want to return data directly as the response body, usually in JSON format. By the end of this video, you will be able to clearly explain Spring MVC, DispatcherServlet, request flow, HandlerMapping, HandlerAdapter, and `@Controller` vs `@RestController` in interviews. Watch the complete Spring Boot Interview Series playlist:    • Spring Boot Interview Questions   Subscribe to Hosiyar.com for more Java, Spring Boot, Backend Development, and Interview Preparation content. #SpringBoot #SpringMVC #DispatcherServlet #SpringBootInterviewQuestions #JavaInterview #RESTAPI #HosiyarDotCom