自动注入servletContext对象
1.
@Autowired
private ServletContext servletContext;
获取项目路径
String webRootPath=servletContext.getRealPath("");
2种
String path = request.getServletContext().getRealPath("");
自动注入servletContext对象
1.
@Autowired
private ServletContext servletContext;
获取项目路径
String webRootPath=servletContext.getRealPath("");
2种
String path = request.getServletContext().getRealPath("");