classpath:只會到你的class路徑中查找找文件;
classpath*:不只包含class路徑,還包括jar文件中(class路徑)進行查找.web
存放位置:
1:src下面
須要在web.xml中定義以下:app
- <context-param>
- <param-name>contextConfigLocation</param-name>
- <param-value>classpath:applicationContext.xml</param-value>
- < /context-param>
2:WEB-INF下面
須要在web.xml中定義以下spa
- <context-param>
- <param-name>contextConfigLocation</param-name>
- <param-value>WEB-INF/applicationContext*.xml</param-value>
- </context-param>
3:xml
- <context-param>
- <param-name>contextConfigLocation</param-name>
- <param-value>/WEB-INF/classes/applicationContext.xml</param-value>
- </context-param>
4:io
- <context-param>
- <param-name>contextConfigLocation</param-name>
- <param-value>/WEB-INF/classes/applicationContext.xml</param-value>
- </context-param>
"**/"表示的是任意目錄;
"**/applicationContext-*.xml"表示任意目錄下的以"applicationContext-"開頭的XML文件。class