The spring profile is the core of the project that integrates the spring framework, where the engine starts, what is done in the middle, and a little talk about its execution process.
The container first loads the Web. xml
Followed by Applicationcontext.xml's registration in Web. xml
One way is to join Contextloaderservlet, the servlet.
<Context-param> <Param-name>Contextconfiglocation</Param-name> <Param-value>/web-inf/applicationcontext.xml</Param-value> </Context-param> <servlet> <Servlet-name>Context</Servlet-name> <Servlet-class>Org.springframework.web.context.ContextLoaderServlet</Servlet-class> <Load-on-startup>0</Load-on-startup> </servlet>
Another is to add contextloaderlistener this listener
<Context-param> <Param-name>Contextconfiglocation</Param-name> <Param-value>/web-inf/applicationcontext.xml</Param-value> </Context-param> <Listener> <Listener-class>Org.springframework.web.context.ContextLoaderListener</Listener-class> </Listener>
Both Contextloaderservlet and Contextloaderlistener are an object that creates Contextloader first. It then calls its Initwebapplicationcontex method to initialize the Webapplicationcontext to obtain an object;
Spring loads multiple configuration files in Web. xml
<Context-param> <Param-name>Contextconfiglocation</Param-name> <Param-value>Classpath*:spring/*.xml</Param-value> </Context-param> <servlet> <Servlet-name>Springcontextservlet</Servlet-name> <Servlet-class>Org.springframework.web.context.ContextLoaderServlet</Servlet-class> <Load-on-startup>3</Load-on-startup> </servlet>
Article derived from: http://www.cnblogs.com/mabaishui/archive/2010/07/14/1777233.html
Spring configuration file