classpath 和 classpath*的 区别:

classpath只会到你指定的class路径中查找找文件
classpath*不仅包含class路径,还包括jar文件中(class路径)进行查找.

举个简单的例子,若web.xml中是这么定义的:

<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath*:META-INF/spring/applicationContext.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7

那么在META-INF/spring这个文件夹底下的所有applicationContext.xml都会被加载到上下文中,这些包括META-INF/spring文件夹底下的 applicationContext.xml,META-INF/spring的子文件夹的applicationContext.xml以及jar中的applicationContext.xml。

而若在web.xml中定义的是:

<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:META-INF/spring/applicationContext.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7

那么只有META-INF/spring底下的applicationContext.xml会被加载到上下文中。

classpath 和 classpath*的 区别:的更多相关文章

  1. web.xml 配置中classpath: 与classpath*:的区别

    首先 classpath是指 WEB-INF文件夹下的classes目录 解释classes含义: 1.存放各种资源配置文件 eg.init.properties log4j.properties s ...

  2. classpath: 和classpath*:的区别

    classpath本质是jvm的根路径,jvm获取资源都是从该根路径下找的,注意这个根路径是个逻辑路径,并不是磁盘路径.比如两个jar包的路径是/a/a.jar和/b/b.jar,但是用classpa ...

  3. 在web.xml中classpath和classpath*的区别

    classpath 和 classpath* 区别: classpath:只会到你指定的class路径中查找找文件; classpath*:不仅包含class路径,还包括jar文件中(class路径) ...

  4. WEB项目web.xml文件中classpath: 跟classpath*:使用的区别

    引用一篇很不错的文章:http://blog.csdn.net/wxwzy738/article/details/16983935 首先 classpath是指 WEB-INF文件夹下的classes ...

  5. 【转载】Spring加载resource时classpath*:与classpath:的区别

    免责声明:     本文转自网络文章,转载此文章仅为个人收藏,分享知识,如有侵权,请联系博主进行删除.     原文作者:kyfxbl     原文地址: spring配置中classpath和cla ...

  6. web.xml中classpath:和classpath*: 有什么区别?

    web.xml中classpath:和classpath*:     IccBoY applicationContext.xml 配置文件的存放位置 web.xml中classpath:和classp ...

  7. Spring配置中的"classpath:"与"classpath*:"的区别研究(转)

    Spring配置中的"classpath:"与"classpath*:"的区别研究(转)   概念解释及使用场景: classpath是指WEB-INF文件夹下 ...

  8. 转:web.xml 配置中classpath: 与classpath*:的区别

    原文链接:web.xml 配置中classpath: 与classpath*:的区别 引用自:http://blog.csdn.net/wxwzy738/article/details/1698393 ...

  9. web.xml 配置中classpath: 与classpath*:的区别——(十一)

    首先 classpath是指 WEB-INF文件夹下的classes目录 解释classes含义: 1.存放各种资源配置文件 eg.init.properties log4j.properties s ...

  10. Spring配置中的"classpath:"与"classpath*:"的区别研究

    概念解释及使用场景: classpath是指WEB-INF文件夹下的classes目录. 通常我们一般使用这种写法实在web.xml中,比如spring加载bean的上下文时,如下: <!--系 ...

随机推荐

  1. python发送邮件相关问题总结

    一.发送邮件报错:554:DT:SPM 1.报错信息 2.通过查找163报错信息页面,554 DT:SPM的问题如下: 3.将邮件主题中的“test”去除,经过测试,实际上邮件主题包含“test”也能 ...

  2. 总结一下vue调试的方法

    1.最推荐使用的是vue的chrome插件: 2.平时开发中常用到的调试代码:console.log().alert():此外还有console.error()这个我用的比较少,感觉跟console. ...

  3. React Native 学习(三)之 FlexBox 布局

    React Native 学习(三)之 FlexBox 布局

  4. 分治分块与计算几何练习 [Cloned]

    https://cn.vjudge.net/contest/148706 A #include<cstdio> #include<cstring> #include<cm ...

  5. EasyRTMP实现将RTSP流转换成RTMP流实现RTSP直播转RTMP直播的功能

    本文转自EasyDarwin开源团队Kim的博客:http://blog.csdn.net/jinlong0603/article/details/52951311 EasyRTMP EasyRTMP ...

  6. a completely rewritten architecture of Hadoop cluster

    https://www.ibm.com/developerworks/library/bd-yarn-intro/

  7. 浏览器访问配置完成的ftp服务器

    在浏览器的地址栏输入: ftp://testuser:testuser@192.168.10.4 testuser 是ftp的用户名和密码: 192.168.10.4 是ftp服务器的IP地址. 亲测 ...

  8. Python pandas 获取Excel重复记录

    pip install pandas pip install xlrd 大量记录的时候,用EXCEL排序处理比较费劲,EXCEL程序动不动就无响应了,用pands完美解决. # We will use ...

  9. MD5 字符串问题

    早上来工位,大家再聊md5,无意中发现网上有个人提出个问题:研究了一下,挺有意思 有个串,通过各种办法得到的值不完全一样,下面请看细节: 假设这个字符串是 “ssss"我用的第一个办法应该是 ...

  10. VVDocument+Appledoc生成文档

    在写代码的时候写上适当的注释是一种良好的习惯,方便自己或者别人阅读的方便. **VVDocument**:(Github地址:[VVDocument](https://github.com/onevc ...