In this chapter, instead of the XML configuration, we will use Java to configure DispatcherServlet in the servlet container for our web application. Servlet 3.0 and later supports java-based bootstrapping, so, we can avoid using the web.xml file. Instead of this, we can create a java class that implements the javax.servlet.ServletContainerInitializer interface. Spring MVC provides the WebApplicationInitializer interface to ensure that your spring configuration is loaded and initialized in any Servlet 3 container. But the Spring MVC framework makes it even easier by providing an abstract class implementation of the WebApplicationInitializer interface. By using this abstract class, you just map your servlet mapping, ...
Defined by Java configuration
Get Spring 5 Design Patterns now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.