Spring资源加载符

地址前缀
1.classpath:(classpath:/)
相对于类的根路径
classpath:com/test/bean.xml
2.file:
使用UrlResource从文件系统目录中装载资源,可采用绝对路径和相对路径
file:/usr/com/test/bean.xml
3.http://
使用UrlResource从Web服务器中装载资源
http://www.test.com/bean.xml
4.ftp://
使用UrlResource从FTP服务器中装载资源
ftp://www.test.com/bean.xml
5.没有前缀
根据ApplicationContext具体实现类采用的Resource装载资源
com/test/bean.xml
6.classpath*:
classpath:com/test/bean.xml在第一个加载的com.test类路径下查找
classpath*:com/test/bean.xml在所有com.test类路径下查找

匹配符
1.?
匹配文件名中的一个字符
2.*
匹配文件名中的任意个字符
3.**
匹配多层路径

猜你喜欢

转载自csolar.iteye.com/blog/2150840