public class Demo {
public static void main(String[] args) throws Exception {
d2();
//http://www.ibm.com/developerworks/cn/java/j-lo-spring-utils1/index.html
}
static void d1() throws Exception {
Resource res = new FileSystemResource("e:/jquery.lazyload.js");
Resource res2 = new ClassPathResource("conf/file.txt");
BufferedReader buf = new BufferedReader(new FileReader(res.getFile()));
String str;
while ((str = buf.readLine()) != null) {
System.out.println(str);
}
}
static void d2() throws Exception{
File file = ResourceUtils.getFile("classpath:applicationContext.xml");
// File file = ResourceUtils.getFile("WebRoot/applicationContext.xml");
// File file = ResourceUtils.getFile("file:D:/conf.xml");
System.out.println(file.getAbsolutePath());
BufferedReader buf = new BufferedReader(new FileReader(file));
String str;
while ((str = buf.readLine()) != null) {
// System.out.println(str);
}
}
}
spring util
最新推荐文章于 2024-08-11 17:04:09 发布