Web程式的啟動(一):在web.xml中的配置spring中applicationContext.xml路徑說明
阿新 • • 發佈:2019-02-08
<context-param> <param-name>contextConfigLocation</param-name> <param-value>WEB-INF/applicationContext*.xml</param-value> </context-param>
當有多個配置檔案載入時,可採用下面程式碼來配置:
<context-param> <param-name>contextConfigLocation</param-name> <param-value> classpath*:conf/spring/applicationContext_core*.xml, classpath*:conf/spring/applicationContext_dict*.xml, classpath*:conf/spring/applicationContext_hibernate.xml, ...... </param-value> </context-param>
也可以用下面的這種方式:
<context-param> <param-name>contextConfigLocation</param-name> <param-value>classpath*:**/applicationContext-*.xml</param-value> </context-param>
"**/"表示的是任意目錄;
"**/applicationContext-*.xml"表示任意目錄下的以"applicationContext-"開頭的XML檔案。
Spring配置檔案最好以"applicationContext-"開頭,且