ContextLoaderListener类(spring源码解析)
来源:互联网 发布:淘宝海尔官方旗舰店 编辑:程序博客网 时间:2024/06/05 05:13
类所在的包:org.springframework.web.context.ContextLoaderListener
其中的一个属性:
public static final String CONFIG_LOCATION_PARAM = "contextConfigLocation";
对应的web.xml文件中的
<context-param> <param-name>contextConfigLocation</param-name> <param-value>/WEB-INF/applicationContext.xml,/WEB-INF/spring-content.xml</param-value></context-param>
简单说,主要作用就是监听当web容器启动时创建WebApplicationContext对象(WebApplicationContext是ApplicationContext的子类)并且存放到ServletContext中。
类似的等效代码
ApplicationContext acc=new ClassPathXmlApplicationContext(“spring-context.xml”);
只是这个代码一般是我们测试时受到创建spring容器对象,而ContextLoaderListener就能在容器启动时自动给我们创建spring容器。
具体怎么创建的呢:
通过ContextLoader.properties文件中配置的
org.springframework.web.context.WebApplicationContext=org.springframework.web.context.support.XmlWebApplicationContext
(WebApplicationContext是接口,XmlWebApplicationContext是实现类)
利用forName()反射机制实例化WebApplicationContext。
0 0
- ContextLoaderListener类(spring源码解析)
- Spring-web源码解析之ContextLoaderListener
- Spring源码学习(二)ContextLoaderListener
- Spring源码之ContextLoaderListener(1)
- Spring源码之ContextLoaderListener(2)
- Spring ContextLoaderListener源码分析
- Spring ContextLoaderListener源码分析 .
- Spring ContextLoaderListener源码分析 .
- Spring配置web.xml中<listener>标签(ContextLoaderListener类解析)解析
- Spring源码之ContextLoaderListener(3)
- Spring mvc ContextLoaderListener 原理解析
- 小读spring ioc源码(二)——ContextLoaderListener
- Spring 学习笔记-- Spring ContextLoaderListener 解析
- Spring源码学习之一 ContextLoaderListener及XmlWebApplicationContext
- 共同学习Spring源码--ContextLoaderListener和ContextCleanupListener
- Spring Framework源码读取-ContextLoaderListener启动过程
- SpringMVC源码(一)ContextLoaderListener
- ContextLoaderListener解析
- Runtime(动态添加方法)笔记
- 七大排序之堆排序
- 【中国标准】 DRA音频标准是什么概念?
- 润乾报表制作折叠报表
- C++幼儿园[0] - 前言
- ContextLoaderListener类(spring源码解析)
- 排序算法之希尔排序(Java)
- 类的析构函数
- debug模式下无法查看变量值
- Android爬坑之旅之WebView
- 博客还要审核
- swift - 循环引用问题
- C++ 4种Cast
- Dom当中对于IE和非IE下事件的封装