spring util

1193 단어 spring

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);
			}
	}
}


좋은 웹페이지 즐겨찾기