springboot文件上传保存到resources里,用
System.getProperty("user.dir");参数即可获得项目相对路径。(ps:不知道是不是springboot内嵌tomcat容器的原因,用网上的request.getServletContext().getRealPath("/")方法获得的路径不是项目路径,而是c盘下一个tomcat目录路径)
System.getProperty("user.dir");
request.getServletContext().getRealPath("/")
保存成功图:
上一篇:SpringBoot中的连接池有哪些
下一篇:JS代码要进行混淆加密的原因