SpringBoot项目获取项目class路径方法
2019-04-21 本文已影响0人
c3e1ce81199b
- 1 使用类加载器路径
String locationPath = ClassUtils.getDefaultClassLoader().getResource("").getPath();
- 2 使用资源路径
String locationPath = ResourceUtils.getURL("classpath:").getPath();
String locationPath = ClassUtils.getDefaultClassLoader().getResource("").getPath();
String locationPath = ResourceUtils.getURL("classpath:").getPath();