PathMatchingResourcePatternResolver是一个通配符的Resource查找器,包括:
/WEB-INF/*-context.xml
com/mycompany/**/applicationContext.xml
file:C:/some/path/*-context.xml
classpath:com/mycompany/**/applicationContext.xml

如果要处理一个目录下的文件就可以下面的代码:

Java代码  spring的PathMatchingResourcePatternResolver-通配符的Resource查找器
  1. ResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();  
  2.       
  3.     Resource[] resources = resolver.getResources("classpath:com/you/atlas/webx/context/*.class");  
  4.       
  5.     System.out.println(resources[0].getURL());  
  6. :file:/home/work/branche/springtest/target/classes/com/you/atlas/webx/context/WebxContextLoader.class  




spring SqlMapClientFactoryBean提供了一个setMappingLocations方法支持“/myApp/*-map.xml”,不用苦逼的增加一个sqlpmap就在xml文件加一条

相关文章:

  • 2021-10-05
  • 2021-09-05
  • 2022-12-23
  • 2021-12-15
  • 2022-12-23
  • 2021-12-12
  • 2021-09-28
猜你喜欢
  • 2021-08-01
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-15
  • 2022-01-17
  • 2022-02-02
相关资源
相似解决方案