如何在程序中使用classpath里面的文件呢?

Resource resource = new ClassPathResource("ehcache-console.xml");

 上面的这段代码,使用了classpath里面的一个Ehcache的xml配置文件。为了达到这个目的,我使用了spring提供的 org.springframework.core.io.Resource 接口以及它的一个实现类。

猜你喜欢

转载自kanpiaoxue.iteye.com/blog/2158187