Skip to content

Instantly share code, notes, and snippets.

@namkyu
Created June 1, 2018 04:56
Show Gist options
  • Save namkyu/6c6e9644ce2f56dbd2fa45b05a29f28a to your computer and use it in GitHub Desktop.
Save namkyu/6c6e9644ce2f56dbd2fa45b05a29f28a to your computer and use it in GitHub Desktop.
파일 read #java
// webApp 스타일
String templatePath = "excel/template_delivery.xls";
System.out.println("클래스 로더 : " + getClass().getClassLoader().getResource(templatePath).toString());
// spring boot 스타일
ClassPathResource classPathResource = new ClassPathResource(templatePath);
System.out.println("클래스 패스 리소스 getPath : " + classPathResource.getPath());
System.out.println("클래스 패스 리소스 getURL : " + classPathResource.getURL());
System.out.println("클래스 패스 리소스 toString : " + classPathResource.toString());
URL url = ResourceUtils.getURL(templatePath);
System.out.println(url);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment