O'Reilly logo

Hands-On High Performance with Spring 5 by Dinesh Radadiya, Prashant Goswami, Pritesh Shah, Subhash Shah, Chintan Mehta

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Configuring front controller

To configure the front controller servlet, DispatcherServlet, in an XML-based configuration, we need to add the following XML code in the web.xml file:

  <servlet>    <servlet-name>spring-mvc</servlet-name>    <servlet-class>      org.springframework.web.servlet.DispatcherServlet    </servlet-class>    <init-param>      <param-name>contextConfigLocation</param-name>      <param-value>/WEB-INF/spring-mvc-context.xml</param-value>    </init-param>    <load-on-startup>1</load-on-startup>  </servlet>  <servlet-mapping>    <servlet-name>spring-mvc</servlet-name>    <url-pattern>/</url-pattern>  </servlet-mapping>

In the preceding XML code, at first, we configured the DispatcherServlet. Then, we mentioned the context configuration location, /WEB-INF/spring-mvc-context.xml ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required