java - Spring类路径前缀区别

标签 java spring classpath

已记录 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/

相关文章:

java - Grails 2.4.4 spring安全角色不适用于用户

java - 为什么我无法在Rhino控制台加载这个类文件?

java - Spring 事务传播和乐观锁定的问题

java - Jmx 客户端抛出 InstanceNotFoundException

java - 如何在 Eclipse 中使用外部 .class 文件?

java - 检查Ant脚本中是否设置了环境变量

java - 是否可以将 JavaFX 的 PerspectiveTransform 与新的 Canvas 类一起使用?

java - 使用 KeyBIndings 响应按钮

spring - Gradle - 多个项目和 git 存储库

java - 如何在 Spring 非 EE 应用程序中注入(inject) infinispan 缓存?