ContextLoader,ContextLoaderListener解读
// 在ServletContext进行初始化时执行。是在任何filter或者Servlet初始化之前。 public void contextInitialized(ServletContextEvent sce);// 在ServletContext销毁时执行。是在所有的filter和Servlet销毁之后进行。 public void contextDestroyed(ServletContextEvent sce);
1 protected WebApplicationContext createWebApplicationContext(ServletContext sc) { 2 Class<?> contextClass = determineContextClass(sc); 3 if (!ConfigurableWebApplicationContext.class.isAssignableFrom(contextClass)) { 4 throw new ApplicationContextException("Custom context class [" + contextClass.getName() + 5 "] is not of type [" + ConfigurableWebApplicationContext.class.getName() + "]"); 6 } 7 return (ConfigurableWebApplicationContext) BeanUtils.instantiateClass(contextClass); 8 }
public class ContextLoaderListener extends ContextLoader implements ServletContextListener
public class ContextLoaderListener extends ContextLoader implements ServletContextListener {public ContextLoaderListener() {}public ContextLoaderListener(WebApplicationContext context) {super(context);}@Overridepublic void contextInitialized(ServletContextEvent event) {initWebApplicationContext(event.getServletContext());}@Overridepublic void contextDestroyed(ServletContextEvent event) {closeWebApplicationContext(event.getServletContext());ContextCleanupListener.cleanupAttributes(event.getServletContext());}}
if (this.context == null) {this.context = createWebApplicationContext(servletContext); }
转载于:https://www.cnblogs.com/larryzeal/p/5885739.html
ContextLoader,ContextLoaderListener解读相关推荐
- springmvc学习记录
<<看透springMvc源代码分析与实践.pdf>> spring Web MVC 框架提供"模型-视图-控制器"( Model-View-Control ...
- Spring MVC 解读——context:component-scan/
2019独角兽企业重金招聘Python工程师标准>>> Spring MVC 解读---<context:component-scan/> 注解是骑士魂牵梦绕的美丽公主, ...
- SpringMVC容器初始化篇----ContextLoaderListener
学习学习容器初始化,若有不对的地方,请指出更正,大家共同学习学习. 此篇幅主要围绕着 ContextLoaderListener加载容器,理解其中的原理. ContextLoaderListener的 ...
- 【Spring】23、ApplicationContext ,ApplicationContextAware,Listener,Event 的关系解读
tomcat容器启动流程 启动tomcat容器,加载web.xml,建立整个容器(Servlet容器,这里是tomcat吧)的上下文,ServletContext,这时web.xml有个监听器,就是C ...
- ContextLoaderListener作用详解
原文:http://blog.csdn.net/ysughw/article/details/8992322 ContextLoaderListener监听器的作用就是启动Web容器时,自动装配App ...
- Spring mvc ContextLoaderListener 原理解析
对于熟悉Spring MVC功能,首先应从web.xml 开始,在web.xml 文件中我们需要配置一个监听器 ContextLoaderListener,如下. <!-- 加载spring上下 ...
- ContextLoaderListener的用途以及配置方式
ContextLoaderListener的作用就是启动Web容器时,自动装配ApplicationContext的配置信息.因为它实现了ServletContextListener这个接口,在web ...
- web.xml中的ContextLoaderListener和DispatcherServlet区别
web.xml中的ContextLoaderListener和DispatcherServlet区别 ContextLoaderListener和DispatcherServlet都会在Web容器启动 ...
- springmvc dao怎么可以不写实现类_SpringMVC(一)细聊ContextLoaderListener 是怎么被加载的...
点击上方"蓝字"关注我们,每天点亮一个技能点. 本文作者:burgxun 云析学院VIP学员 前言 为什么要写博客呢?其实还是源于我在知乎上面的 看到的一个回答.问题是这样的:生活 ...
最新文章
- 什么是图神经网络 (GNN)?
- idea不区分大小写设置_我的 IntelliJ IDEA 一直都是这么设置的,效果很棒!
- linux ubuntu 开机自动启动 fixfox 并打开指定网站
- 关于make *.img时没有权限的问题
- python dict sorted
- POJ 1222 EXTENDED LIGHTS OUT(高斯消元)
- JDK 14的新特性:instanceof模式匹配
- CentOS 7 中firewall-cmd命令
- AI超人赛车手狂虐人类登Nature封面!1000台PS4训练,「苏菲」极限超车独霸赛道...
- 计算机模拟数学实验动画,计算机图形学实验-简单动画的实现、三维图形变换.docx...
- Ubuntu下Apache反向代理设置
- python中urllib.parse啥意思_python-urllib.parse模块简述
- C语言基础教程之强制类型转换
- JavaScript函数和对象
- 全概率公式和贝叶斯公式的定义与说明
- mariadb 的安装及基本配置
- 需求分析及技术方案设计
- 如何快速打开控制面板?如何让控制面板在桌面显示?
- 知识 | 四种渲染到底是啥?终于有人讲明白了(下)
- Suit and Tie (在线swap 贪心 思维)