已记录 here它指出
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.
有人能解释一下吗?
使用 classpath*:conf/appContext.xml
与不带星号的 classpath:conf/appContext.xml
有什么区别。
最佳答案
简单定义
classpath*:conf/appContext.xml
只是表示你所有jar 中conf
文件夹下的all appContext.xml 文件类路径将被拾取并加入到一个大的应用程序上下文中。
相比之下,classpath:conf/appContext.xml
将只加载一个这样的文件...在您的类路径中找到的第一个文件。
关于java - Spring类路径前缀区别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3294423/