web.xml(ContextLoaderListener)
来源:互联网 发布:地狱解剖知乎 编辑:程序博客网 时间:2024/06/07 15:52
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
1.ContextLoaderListener的作用:在启动Web容器时,自动装配Spring applicationContext.xml的配置信息。
参考文档:http://blog.csdn.net/panxuying123/article/details/16910885
网上通常说,listener通常会和context-param一起配合使用,看了上面的文档,如下:
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:applicationContext.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
在全局参数里面配置了classpath:applicationContext.xml的路径,在listener中配置了ContextLoaderListener这个类,之所以说这个类的作用是自动装配Spring applicationContext.xml的配置信息,是因为它实现了一个ServletContextListener接口。在ContextLoaderListener这个监听的类中有个contextInitialized(ServletContextEvent event)的方法,在这个方法中可以通过event.getServletContext().getInitParameter("contextConfigLocation") 来得到context-param 设定的值。所以网上说listener通常会和context-param一起配合使用。
- web.xml(ContextLoaderListener)
- web.xml配置文件中ContextLoaderListener的作用
- web.xml配置详解 org.springframework.web.context.ContextLoaderListener
- web.xml文件中配置spring的ContextLoaderListener后报错
- spring项目中,web.xml中的 ContextLoaderListener监听器的原理
- [Spring]web.xml中配置ContextLoaderListener监听器的作用
- [Spring]web.xml中配置ContextLoaderListener监听器的作用
- web.xml中DispatcherServlet和ContextLoaderListener的区别
- web.xml中spring如何通过ContextLoaderListener初始化的
- Spring源码分析 从web.xml 中ContextLoaderListener看Spring 容器与web容器联系
- Spring配置web.xml中<listener>标签(ContextLoaderListener类解析)解析
- 在搭建Spring框架时,web.xml文件的配置之DispatcherServlet&ContextLoaderListener
- 原博文补充: web.xml配置中ContextLoaderListener和DispatcherServlet的区别:
- web.xml加载顺序第一步listener标签里面的 ContextLoaderListener详解
- org.springframework.web.context.ContextLoaderListener
- org.springframework.web.context.ContextLoaderListener
- org.springframework.web.context.ContextLoaderListener
- org.springframework.web.context.ContextLoaderListener
- 多线程问题
- git 操作
- javascript的执行环境及作用域(一)
- SOAPA众等,你准备好了吗?
- [MySQL]Linux 安装Rmp格式
- web.xml(ContextLoaderListener)
- c++ 虚继承与继承的差异
- html页面缩小后自动出现滚动条
- 润乾报表 行式填报表如何实现批量删除效果
- protobuf的安装和卸载
- agjs
- 378. Kth Smallest Element in a Sorted Matrix
- CSS-定位
- Android ViewFlipper的使用