Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | ||||
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
Tags
- import
- find
- JavaScript
- grep
- Mac
- Quartz
- 줄바꿈 문자
- vscode
- netsh
- VirtualBox
- web.xml
- port
- resource
- maVen
- tomcat
- profile
- xargs
- 단축키
- IntelliJ
- Windows
- Eclipse
- Source
- ssh
- bash
- 네트워크
- GIT
- Windows 10
- lsof
- plugin
- context
Archives
- Today
- Total
develog
[spring boot] static file 본문
file 경로
src/main/resources/static/readme11.txt |
controller
@Controller public class MyController { @Autowired private ResourceLoader resourceLoader; @RequestMapping(value = "/hello") public String hello() throws Exception { File file = null; ClassPathResource cpr = new ClassPathResource("static/readme11.txt"); System.out.println("11, " + cpr.exists() + ", " + cpr.getPath()); Resource resource = resourceLoader.getResource("classpath:static/readme11.txt"); file = resource.getFile(); System.out.println("22, " + file.exists() + ", " + file.getPath()); file = ResourceUtils.getFile("classpath:static/readme11.txt"); System.out.println("22, " + file.exists() + ", " + file.getPath()); return "hello"; } } |
'Dev > Spring Boot' 카테고리의 다른 글
Spring Boot jar, docker build (0) | 2020.08.06 |
---|---|
[spring boot] static file read (0) | 2020.02.13 |
[spring boot] @SpringBootTest, MockMvc (0) | 2020.02.07 |
[H2] spring boot 에서 h2 memory db 사용하기 (0) | 2019.12.13 |
[spring boot] jsp (0) | 2019.11.27 |
Comments