【发布时间】:2018-03-15 13:44:06
【问题描述】:
我这样写路径时获取不到spring boot静态文件:
private static final String FILE_PATH = "/resources/data/user.json";
【问题讨论】:
标签: spring-boot static filenotfoundexception
我这样写路径时获取不到spring boot静态文件:
private static final String FILE_PATH = "/resources/data/user.json";
【问题讨论】:
标签: spring-boot static filenotfoundexception
尝试使用 ClasspathResource
Resource resource = new ClassPathResource("/static/data/user.json");
File file = resource.getFile();
【讨论】: