Spring监听器ContextLoaderListener的作用
来源:互联网 发布:淘宝商城墙贴 编辑:程序博客网 时间:2024/06/10 18:47
Spring监听器ContextLoaderListener的作用
文章分类:Java编程在SSH项目中我们自动加载spring配置文件需要在web.xml文件中添加一段配置:
- <context-param>
- <param-name>contextConfigLocation</param-name>
-
-
classpath*:applicationContext-*.xml -
- </context-param>
-
- <listener>
-
-
org.springframework.web.context.ContextLoaderListener -
- </listener>
===========================================
ContextLoaderListener的作用就是启动Web容器时,自动装配ApplicationContext的配置信息。因为它实现了ServletContextListener这个接口,在web.xml配置这个监听器,启动容器时,就会默认执行它实现的方法。至于ApplicationContext.xml这个配置文件部署在哪,如何配置多个xml文件,书上都没怎么详细说明。现在的方法就是查看它的API文档。在ContextLoaderListener中关联了ContextLoader这个类,所以整个加载配置过程由ContextLoader来完成。看看它的API说明
第一段说明ContextLoader可以由 ContextLoaderListener和ContextLoaderServlet生成。如果查看ContextLoaderServlet的API,可以看到它也关联了ContextLoader这个类而且它实现了HttpServlet。 这个接口
BeanFactory这样一来spring中的所有bean都由这个类来创建
-
-
-
/WEB-INF/classes/applicationContext-*.xml -
-
- Spring :监听器ContextLoaderListener的作用
- Spring监听器ContextLoaderListener的作用
- Spring监听器ContextLoaderListener的作用
- Spring监听器ContextLoaderListener的作用
- Spring :监听器ContextLoaderListener的作用
- 监听器ContextLoaderListener的作用
- 监听器的作用-ContextLoaderListener
- [Spring]web.xml中配置ContextLoaderListener监听器的作用
- [Spring]web.xml中配置ContextLoaderListener监听器的作用
- 详解ContextLoaderListener监听器的作用
- spring项目中监听器作用-ContextLoaderListener
- spring项目中监听器作用-ContextLoaderListener
- Spring——监听器ContextLoaderListener作用
- spring监听器ContextLoaderListener的疑问
- spring ContextLoaderListener的作用
- [Spring] ContextLoaderListener的作用
- spring ContextLoaderListener的作用
- spring ContextLoaderListener的作用
- hadoop2.x.x格式化遇到的问题
- [DS][3-19]Evaluate a postfix expression
- 使用Hadoop流进行MapReduce时出现subprocess failed with code 2 No such file or dictionary时的解决方式
- leetcode - Spiral Matrix II
- 传教士与野人过河问题(二)
- Spring监听器ContextLoaderListener的作用
- linux进程通信之命名管道
- easyui datagrid如何重新加载不同url
- 《Linux程序设计》第四版第二章 我的第一个shell程序:CD唱片应用程序
- MMU工作原理分析
- CentOS7 Samba4.11
- android数据存储与访问之使用SharedPreferences
- 《C++Primer》读书笔记---基本语言
- DataNode连接错误Retrying connect to server