WebApplicationContext类的作用

WebApplicationContext是实现ApplicationContext接口的子类。是专门为WEB应用准备的。
作用: 1.它允许从相对于Web根目录的路径中加载配置文件完成初始化工作。从WebApplicationContext中可以获取ServletContext引用,整个Web应用上下文对象将作为属性放置在ServletContext中,
以便Web应用环境可以访问Spring上下文。 2.WebApplicationContext还为Bean提供了三个新的作用域,request、session和globalsession。 其中两个参数HttpServletRequest:服务器从客户端拿去数据 ,HttpServletResponse:服务器向前台传送数据。
原文地址:https://www.cnblogs.com/ydymz/p/8462470.html