Spring configuration file

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.