The main program of Spring MVC is DispatcherServlet. Most Spring MVC webapp's web.xml is as follows. <?xml version="1.0" encoding="UTF-8"?> <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"> <!-- The definition of the Root Spring Container shared by all Servlets and Filters --> <context-param> <param-name>contextConfigLocation</param-name> <param-value>/WEB-INF/spring/root-context.xml</param-value> </context-param> <listener> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> </listener> <servlet> <servlet-name>appServlet</servlet-name> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> <init-param> <param-name>contextConfigLocation</param-name> <param-value>/WEB-INF/spring/appServlet/servlet-context.xml</param-value> </init-param> <load-on-startup>1</load-on-startup> … Continue reading The inner working of DispatcherServlet
Tag: Spring framework
8 ways to declare Spring beans
Beginning Spring programming is simple, but it's difficult to take over someone's source code. In my opinion, it stems from different ways to declare Spring beans. I summarized 8 ways to declare Spring beans. 1. Xml based bean configuration The bean itself is just a pojo class. Inside bean configuration xml, the following tag declare … Continue reading 8 ways to declare Spring beans