Spring ApplicationContext可以做到这一点:
ApplicationContext context = new ClassPathXmlApplicationContext("applicationConext.xml");
Resource[] xmlResources = context.getResources("classpath:/**/*.xml");
Run Code Online (Sandbox Code Playgroud)
请参阅ResourcePatternResolver#getResources或ApplicationContext.
小智 6
List<URL> resources = CPScanner.scanResources(new PackageNameFilter("net.sf.corn.cps.sample"), new ResourceNameFilter("A*.xml"));
Run Code Online (Sandbox Code Playgroud)
把代码段放在你的pom.xml中
<dependency>
<groupId>net.sf.corn</groupId>
<artifactId>corn-cps</artifactId>
<version>1.0.1</version>
</dependency>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
11353 次 |
| 最近记录: |