The Heart of Spring Web MVC
In Spring MVC framework Dispatcher Servlet access Front Controller which handles all coming requests and queues for forwarding to the different controller. The front controller is a typical design pattern in the web applications development. In this case, a single servlet receives all requests and transfers them to all other components of the application. The task of the DispatcherServlet is sent a request to the specific Spring MVC controller.
DispatcherServlet is responsible for initializing the WebApplicationContext and it loads all configuration related to the web components like controllers, view resolver, interceptors etc., It will be loaded and initialized by calling init() method init() of DispatcherServlet will try to identify the Spring Configuration Document with naming conventions like “servlet_name-servlet.xml” then all beans can be identify.
public class DispatcherServlet extends HttpServlet { ApplicationContext ctx = null; public void init(ServletConfig cfg){ // 1. try to get the spring configuration document with default naming conventions String xml = "servlet_name" + "-servlet.xml"; //if it was found then creates the ApplicationContext object ctx = new XmlWebApplicationContext(xml); } ... }
Strategy Design Patterns We can easily create a strategy design pattern using lambda. To implement…
Decorator Pattern A decorator pattern allows a user to add new functionality to an existing…
Delegating pattern In software engineering, the delegation pattern is an object-oriented design pattern that allows…
Technology has emerged a lot in the last decade, and now we have artificial intelligence;…
Managing a database is becoming increasingly complex now due to the vast amount of data…
Overview In this article, we will explore Spring Scheduler how we could use it by…