Spring 获取当前web的根路径

//获取当前web容器的BeanFactory
WebApplicationContext webApplicationContext = ContextLoader.getCurrentWebApplicationContext();
 
//获取web的上下文信息
ServletContext servletContext = webApplicationContext.getServletContext();

//获取根路径
servletContext.getRealPath("/")
相关文章
相关标签/搜索