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 . |