springboot文件上传保存到resources里,用

System.getProperty("user.dir");参数即可获得项目相对路径。(ps:不知道是不是springboot内嵌tomcat容器的原因,用网上的request.getServletContext().getRealPath("/")方法获得的路径不是项目路径,而是c盘下一个tomcat目录路径)

springboot项目获取resources路径(相对路径)

 

保存成功图:

springboot项目获取resources路径(相对路径)

相关文章:

  • 2022-02-07
  • 2022-12-23
  • 2021-08-07
  • 2021-08-24
  • 2021-10-19
猜你喜欢
  • 2022-01-07
  • 2022-12-23
  • 2021-12-07
  • 2022-12-23
  • 2022-12-23
  • 2021-09-26
  • 2022-12-23
相关资源
相似解决方案