springMvc获取servletContext

//  001
WebApplicationContext webApplicationContext = ContextLoader.getCurrentWebApplicationContext();
ServletContext servletContext = webApplicationContext.getServletContext();


// 002 这个可以是2.5规范下面使用
RequestContextUtils.getWebApplicationContext(request).getServletContext();


// 003 这个是3.0规范的;
ServletContext context = req.getServletContext();

 

相关文章:

  • 2022-12-23
  • 2023-01-12
  • 2021-06-16
  • 2022-12-23
  • 2022-01-26
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-07-06
  • 2022-01-14
  • 2021-12-16
  • 2022-12-23
  • 2022-12-23
  • 2021-06-12
  • 2021-06-25
相关资源
相似解决方案