WebApplicationContext 获得web下文件存储
2018-03-24 本文已影响0人
ThingLin
WebApplicationContext webApplicationContext = ContextLoader.getCurrentWebApplicationContext();
ServletContext servletContext = webApplicationContext.getServletContext();
String realPath = servletContext.getRealPath("/upload");
logger.info("文件存储路径 realPath = {}",realPath);