-
Book Overview & Buying
-
Table Of Contents
Spring Essentials
By :
DispatcherServlet is the gateway to any Spring MVC application. Inherited from javax.servlet.http.HttpServlet, it is typically configured declaratively in the web.xml file. While you can have multiple definitions of DispatcherServlet with unique URL patterns, most Spring MVC applications only have single DispatcherServlet with the context-root URL(/), that is, all requests coming to that domain will be handled by DispatcherServlet.
Starting from Servlet 3.0, in addition to declarative configuration in the web.xml file, DispatcherServlet can be configured programmatically by implementing or extending either of these three support classes provided by Spring:
The WebAppInitializer interface
The AbstractDispatcherServletInitializer abstract class
The AbstractAnnotationConfigDispatcherServletInitializer abstract class
The following code listing demonstrates how to implement a WebAppInitializer directly in your application:
public class ApplicationInitializer implements...
Change the font size
Change margin width
Change background colour