develog

[spring boot] static file read 본문

Dev/Spring Boot

[spring boot] static file read

냐옴 2020. 2. 13. 00:21

ClassPathResource

File file = new ClassPathResource("static/findMe.txt").getFile();

 

ResourceLoader

@Autowired ResourceLoader resourceLoader;
File file = resourceLoader.getResource("classpath:static/findMe.txt").getFile();

 

ResourceUtils

File file = ResourceUtils.getFile("classpath:static/findMe.txt");

'Dev > Spring Boot' 카테고리의 다른 글

[spring boot] multiple properties file  (0) 2020.08.12
Spring Boot jar, docker build  (0) 2020.08.06
[spring boot] @SpringBootTest, MockMvc  (0) 2020.02.07
[H2] spring boot 에서 h2 memory db 사용하기  (0) 2019.12.13
[spring boot] static file  (0) 2019.11.27
Comments