Defined by Java configuration
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, ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access