file = ResourceUtils.getFile("classpath:static/template.xlsx");
/** * 获取静态文件物理地址 */ public static String getRealPath(HttpServletRequest request) { String realPath = request.getSession().getServletContext().getRealPath("/") + "/static/"; realPath = realPath.replaceAll("\\\\", "/"); return realPath; } /** * 获取静态文件网络地址 */ public static String getStaticNetPath(HttpServletRequest request) { String netPath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + request.getContextPath() + "/static/"; return netPath; }