Spring classpath前缀差异 [英] Spring classpath prefix difference
问题描述
记录这里它声明
这个特殊的前缀指定所有
类路径资源与给定的
匹配name必须获得
(在内部,这实际上是通过ClassLoader.getResources(...)
调用发生
),然后合并形成
最终应用程序上下文定义。
有人可以解释一下吗?
使用 classpath *:conf / appContext.xml
与相比有什么区别? > classpath:conf / appContext.xml
没有星号。
SIMPLE DEFINITION <这是所有appContext.xml文件下 conf
类路径中所有jar中的文件夹将被选中并加入一个大的应用程序上下文。
相比之下, classpath:conf / appContext.xml
将加载只有一个这样的文件 ...第一个在你的文件中找到classpath。
Documented here it states
This special prefix specifies that all classpath resources that match the given name must be obtained (internally, this essentially happens via a ClassLoader.getResources(...) call), and then merged to form the final application context definition.
Can someone explain this?
What is the difference between using classpath*:conf/appContext.xml
as opposed to classpath:conf/appContext.xml
without the asterisk.
SIMPLE DEFINITION
The classpath*:conf/appContext.xml
simply means that all appContext.xml files under conf
folders in all your jars on the classpath will be picked up and joined into one big application context.
In contrast, classpath:conf/appContext.xml
will load only one such file... the first one found on your classpath.
这篇关于Spring classpath前缀差异的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!