Spring / Spring7 basics Interview questions
What is the DispatcherServlet in Spring MVC?
DispatcherServlet is the single front controller that every incoming HTTP request in a Spring MVC application passes through first. It doesn't contain business logic itself; instead it coordinates the whole request-handling pipeline - consulting handler mappings, invoking interceptors, calling your controller method, and choosing how to render the result.
flowchart LR
A[HTTP Request] --> B[DispatcherServlet]
B --> C[HandlerMapping]
C --> D[Controller method]
D --> E[ViewResolver or Message Converter]
E --> F[HTTP Response]
In a Spring Boot app, DispatcherServlet is registered and configured automatically by auto-configuration, mapped to / by default. For a @RestController, it skips view resolution entirely and hands the return value straight to an HttpMessageConverter to be written as JSON or another format.
Invest now in Acorns!!! 🚀
Join Acorns and get your $5 bonus!
Acorns is a micro-investing app that automatically invests your "spare change" from daily purchases into diversified, expert-built portfolios of ETFs. It is designed for beginners, allowing you to start investing with as little as $5. The service automates saving and investing. Disclosure: I may receive a referral bonus.
Invest now!!! Get Free equity stock (US, UK only)!
Use Robinhood app to invest in stocks. It is safe and secure. Use the Referral link to claim your free stock when you sign up!.
The Robinhood app makes it easy to trade stocks, crypto and more.
Webull! Receive free stock by signing up using the link: Webull signup.
More Related questions...
