// 获取项目根路径
final File basePath = new File(ResourceUtils.getURL("classpath:").getPath());

这个再Windows下是可以的,但是在Linux (centos7)下是不行的,正确的获取方法:

 

Resource resource = new ClassPathResource("");
System.out.println(resource.getFile().getAbsolutePath());

 

相关文章:

  • 2021-11-18
  • 2022-01-02
  • 2022-12-23
  • 2022-02-07
  • 2021-12-17
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-01-07
  • 2022-01-21
  • 2021-06-26
  • 2022-02-21
  • 2022-12-23
  • 2022-12-23
  • 2021-12-09
相关资源
相似解决方案