spring配置文件中classpath与classpath* 的区别

来源:互联网 发布:怎么做 数据质量管控 编辑:程序博客网 时间:2024/06/04 17:53

lib和classses下文件访问的优先级

lib>classes

对于性能的影响不在这个里面:

classpath与classpath*区别

classpath:只会在你的classes的路径中查找文件

classpath:不仅包含class路径,还包含jar中的(class路径)查找

使用classpath*:需要遍历所有的classpath,所有加载的速度比较慢,因此在规划的时候最好使用classpath。

在spring中的配置文件中使用的标签<context:property-placeholder location="配置文件">或者<context:property-placeholder location="classpath:配置文件">

在spring配置文件,只能使用一个<context:property-placeholder >,spring容器是采用扫描反射发现机制,通过标签的命名空间实例化实例,当spring容器中有一个

org.springframework.beans.factory.config.PropertyPlaceCvonfigurer的bean就会停止对剩余PropertyPlaceholderConfigurers扫描,只能存在一个实例。


阅读全文
0 0
原创粉丝点击