Spring: some basic configurations-you may only be able to understand them.

Source: Internet
Author: User

 

Web. xml

  <  Context-Param  >  
< Param-name > Contextconfiglocation </ Param-name >
< Param-Value > /WEB-INF/daocontext. xml/WEB-INF/applicationcontext. xml </ Param-Value >
</ Context-Param >

< Listener >
< Listener-class > Org. springframework. Web. Context. contextloaderlistener </ Listener-class >
</ Listener >

<! -- Or use the contextloaderservlet instead of the above listener
<Servlet>
<Servlet-Name> context </servlet-Name>
<Servlet-class> org. springframework. Web. Context. contextloaderservlet </servlet-class>
<Load-on-startup> 1 </load-on-startup>
</Servlet>
-->

 

The listener first checksContextconfiglocationParameter. If it does not exist, it uses/WEB-INF/applicationcontext. xmlAs the default value. If it already exists, it will use a separator (comma, colon, or space) to split the string into the path of the upper and lower file locations for the application. Supports the ant-style path mode, such/WEB-INF/* context. xml(All files ending with "context. xml" under the WEB-INF folder ). Or/WEB-INF/**/* context. xml(The WEB-INF folder and the file ending with "context. xml" under the subfolders ).

ContextloaderservletSameContextloaderlistenerSame use'Textconfiglocation'Parameters.

 

Resource strings

prefix example description

classpath:

classpath: COM/MyApp/config. xml

load from classpath.

file:

file:/data/config. xml

load as URL from the file system.

HTTP:

http: // myserver/logo.png

load as URL .

(none)

/data/config. xml

judge by applicationcontext .

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.