ClassPathResource

使用
     ClassPathResource er = new ClassPathResource(".");
     String path = er.getFile().getAbsolutePath();

获取CLASSPATH路径
为:
E:\study\struts2spring\WebRoot\WEB-INF\classes

为了获取配置文件spring.xml,需要将配置放到src目录下,编译时自动将该配置文件
放到classes目录下
ClassPathResource isr = new ClassPathResource("spring.xml");

获取该文件

你可能感兴趣的:(spring,struts)