PathMatchingResourcePatternResolver是一個Ant通配符模式的Resource查找器,能夠用來查找類路徑下或者文件系統中的資源。spring
classpath: 用於加載類路徑(包括jar包)中的一個且僅一個資源spa
classpath*: 用於加載類路徑(包括jar包)中的全部匹配的資源blog
ResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();資源
Resource[] resources = null;get
//加載一個資源it
resources = resolver.getResources("classpath:META-INF/spring.factories");class
resources = resolver.getResources("META-INF/spring.factories");file
resources = resolver.getResources("http://www.baidu.com");文件
//加載多個資源文件系統
resources = resolver.getResources("classpath*:META-INF/spring.factories");
resources = resolver.getResources("classpath*:META-INF/*.factories");
resources = resolver.getResources("file:d:/*.txt");
resources = resolver.getResources("classpath*:com/seasy/**/*.class");