web.xml中classpath:和classpath*的區別

classpath:只會到你的class路徑中查找找文件; 
classpath*:不只包含class路徑,還包括jar文件中(class路徑)進行查找.web

存放位置:
1:src下面
須要在web.xml中定義以下:app

  1. <context-param>  
  2. <param-name>contextConfigLocation</param-name>  
  3. <param-value>classpath:applicationContext.xml</param-value>  
  4. < /context-param> 

2:WEB-INF下面
須要在web.xml中定義以下spa

  1. <context-param>  
  2. <param-name>contextConfigLocation</param-name>  
  3. <param-value>WEB-INF/applicationContext*.xml</param-value>  
  4. </context-param>  

3:xml

  1. <context-param>   
  2. <param-name>contextConfigLocation</param-name>   
  3. <param-value>/WEB-INF/classes/applicationContext.xml</param-value>   
  4. </context-param>   

4:io

  1. <context-param>   
  2. <param-name>contextConfigLocation</param-name>   
  3. <param-value>/WEB-INF/classes/applicationContext.xml</param-value>   
  4. </context-param>   

    "**/"表示的是任意目錄; 
    "**/applicationContext-*.xml"表示任意目錄下的以"applicationContext-"開頭的XML文件。class

相關文章
相關標籤/搜索