获取项目中的文件方法

tomcat环境获取文件方法:

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

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

 

 

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

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

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

 

posted @ 2019-06-10 13:51  鸿毛浮绿水  阅读(585)  评论(0编辑  收藏  举报