WebApplicationContext是实现ApplicationContext接口的子类。是专门为WEB应用准备的。
作用:
1. 它允许从相对于Web根目录的路径中加载配置文件完成初始化工作。从WebApplicationContext中可以获取ServletContext引用,整个Web应用上下文对象将作为属性放置在ServletContext中,以便Web应用环境可以访问Spring上下文。
2.WebApplicationContext还为Bean提供了三个新的作用域,request、session和globalsession。
其中两个参数HttpServletRequest:服务器从客户端拿去数据
HttpServletResponse:服务器向前台传送数据
本文介绍了WebApplicationContext,它是ApplicationContext接口的一个子类,专为Web应用设计。文章详细解释了它如何加载配置文件并初始化,以及如何通过它获取ServletContext引用。此外,还提到了WebApplicationContext提供的三种新的Bean作用域:request、session和globalsession。
1589

被折叠的 条评论
为什么被折叠?



