获取项目中的文件方法

tomcat环境获取文件方法:

String htmlFile = request.getServletContext().getRealPath("/html/zhantu.html");

下面是我在Jersey框架中开发的:

springboot环境获取resouces下的文件方法:

ResourceUtils.getFile("classpath:html").getPath();(html是我在resources下建的文件夹名称)

下面是在springboot环境springmvc框架中获取文件的方法:

原文地址:https://www.cnblogs.com/ww25/p/10997289.html