AbstractApplicationContext 笔记
一、这个类的属性
public abstract class AbstractApplicationContext extends DefaultResourceLoader
implements ConfigurableApplicationContext, DisposableBean { /**
* Name of the MessageSource bean in the factory.
* If none is supplied, message resolution is delegated to the parent.
* @see MessageSource
*/
//Bean工厂中MessageSource接口的Bean实例的名称。
public static final String MESSAGE_SOURCE_BEAN_NAME = "messageSource"; /**
* Name of the LifecycleProcessor bean in the factory.
* If none is supplied, a DefaultLifecycleProcessor is used.
* @see org.springframework.context.LifecycleProcessor
* @see org.springframework.context.support.DefaultLifecycleProcessor
*///LifecycleProcessor 接口的bean实例,如果没有提供的话就使用默认的DefaultLifecycleProcessor
public static final String LIFECYCLE_PROCESSOR_BEAN_NAME = "lifecycleProcessor"; /**
* Name of the ApplicationEventMulticaster bean in the factory.
* If none is supplied, a default SimpleApplicationEventMulticaster is used.
* @see org.springframework.context.event.ApplicationEventMulticaster
* @see org.springframework.context.event.SimpleApplicationEventMulticaster
*///事件广播器ApplicationEventMulticaster接口的一个bean实例。如果没有提供的话就使用SimpleApplicationEventMulticaster
public static final String APPLICATION_EVENT_MULTICASTER_BEAN_NAME = "applicationEventMulticaster"; static {
// Eagerly load the ContextClosedEvent class to avoid weird classloader issues
// on application shutdown in WebLogic 8.1. (Reported by Dustin Woods.)
ContextClosedEvent.class.getName();
} /** Logger used by this class. Available to subclasses. *///logger用来打印日志的。
protected final Log logger = LogFactory.getLog(getClass()); /** Unique id for this context, if any *///这个应用上下文的id
private String id = ObjectUtils.identityToString(this); /** Display name *///这个应用上下文(ApplicationContext)的名称,由这个类的 类名+ @ + 这个context对象的hash值 组成。
private String displayName = ObjectUtils.identityToString(this); /** Parent context *///父context
private ApplicationContext parent; /** Environment used by this context */
//context需要使用到的Environment对象。这个对象的作用是操作属性来源。包括添加、移除、重新排序、替换等。
private ConfigurableEnvironment environment; /** BeanFactoryPostProcessors to apply on refresh *///这个List用于存放Bean工厂处理器(BeanFactoryPostProcessor)。
private final List<BeanFactoryPostProcessor> beanFactoryPostProcessors =
new ArrayList<BeanFactoryPostProcessor>(); /** System time in milliseconds when this context started */
private long startupDate;//context的启动时间。毫秒为单位。long 型变量。 /** Flag that indicates whether this context is currently active *///active表示的当前context是否正处于的活动状态。
private final AtomicBoolean active = new AtomicBoolean(); /** Flag that indicates whether this context has been closed already *///closed表示当前的context是否已经关闭。
private final AtomicBoolean closed = new AtomicBoolean(); /** Synchronization monitor for the "refresh" and "destroy" *///这个对象用在refresh()和destroy()方法中的synchronized块。起到对象锁的作用。
private final Object startupShutdownMonitor = new Object(); /** Reference to the JVM shutdown hook, if registered */
private Thread shutdownHook;//JVM关闭的钩子。 /** ResourcePatternResolver used by this context *///这个是策略接口(涉及到策略模式),用于加载资源,比如类路径下的xml文件,或者是文件系统中的文件。
private ResourcePatternResolver resourcePatternResolver; /** LifecycleProcessor for managing the lifecycle of beans within this context */
private LifecycleProcessor lifecycleProcessor;//生命周期处理器,用来管理context中具有生命周期的bean。 /** MessageSource we delegate our implementation of this interface to */
private MessageSource messageSource;//这也是一个策略接口,用于国际化方面的。 /** Helper class used in event publishing *///事件广播器,用来发布事件,将事件告诉监听器的。
private ApplicationEventMulticaster applicationEventMulticaster; /** Statically specified listeners *///用来存储监听器的。
private final Set<ApplicationListener<?>> applicationListeners = new LinkedHashSet<ApplicationListener<?>>(); /** ApplicationEvents published early *///用来存储事件的。
private Set<ApplicationEvent> earlyApplicationEvents;
AbstractApplicationContext 笔记的更多相关文章
- Spring AbstractApplicationContext抽象类的refresh()方法--笔记
Spring中AbstractApplicationContext抽象类的refresh()方法是用来刷新Spring的应用上下文的.下面Spring的应用上下文我都叫作context @Overri ...
- spring入门教程——笔记
Spring学习笔记(1)----简单的实例 --------------------------------- 首先需要准备Spring包,可从官方网站上下载. 下载解压后,必须的两个包是s ...
- Spring源码阅读笔记
前言 作为一个Java开发者,工作了几年后,越发觉力有点不从心了,技术的世界实在是太过于辽阔了,接触的东西越多,越感到前所未有的恐慌. 每天捣鼓这个捣鼓那个,结果回过头来,才发现这个也不通,那个也不精 ...
- Java框架spring 学习笔记(十四):注解aop操作
回见Java框架spring Boot学习笔记(十三):aop实例操作,这里介绍注解aop操作 首先编写一个切入点HelloWorld.java package com.example.spring; ...
- 不错的Spring学习笔记(转)
Spring学习笔记(1)----简单的实例 --------------------------------- 首先需要准备Spring包,可从官方网站上下载. 下载解压后,必须的两个包是s ...
- 【Spring-AOP-学习笔记】
http://outofmemory.cn/java/spring/spring-DI-with-annotation-context-component-scan https://www.cnblo ...
- Spring笔记(6) - Spring的BeanFactoryPostProcessor探究
一.背景 在说BeanFactoryPostProcessor之前,先来说下BeanPostProcessor,在前文Spring笔记(2) - 生命周期/属性赋值/自动装配及部分源码解析中讲解了Be ...
- Spring源码学习笔记12——总结篇,IOC,Bean的生命周期,三大扩展点
Spring源码学习笔记12--总结篇,IOC,Bean的生命周期,三大扩展点 参考了Spring 官网文档 https://docs.spring.io/spring-framework/docs/ ...
- git-简单流程(学习笔记)
这是阅读廖雪峰的官方网站的笔记,用于自己以后回看 1.进入项目文件夹 初始化一个Git仓库,使用git init命令. 添加文件到Git仓库,分两步: 第一步,使用命令git add <file ...
随机推荐
- 【VUE】vue项目开发中,setTimeout等定时器的管理。
如果在一个组件中使用了定时器,当通过路由切换页面的时候 1.如果有同一个组件,定时器会叠加. 解决方案: computed:{ timer: { set (val) { this.$store.sta ...
- SQL 修改表字段失败 解决方法
OK 大功告成 !!!
- C#绑定数据
1.<asp:DropDownList <asp:DropDownList ID="ddlclientType" runat="server" Wi ...
- 在IIS7中应用Application Request Routing配置反向代理
配置反向代理软件.zip 开启Proxy项: 该设置表面只有HTTP_HOST为phpweb.leven.com.cn的URL才能通过该规则,如果您绑定了多个域名,可以根据多次增加或者通过正则表达式的 ...
- WPF流程图制作系列相关基础一
WPF流程图制作相关基础一 需求是要通过wpf开发流程图,这个流程图是用户自行拖动配置. 使用过流程图的话,应该大体能想象出流程图拖动配置的样子.这里主要会涉及到的技术知识点就是 wpf拖动相 ...
- C Traps:运算
位移 如果sizeof(int) = 4,那么下面的代码的结果是什么? int x=255; printf("%d", x>>34); 实际输出:63 在编译这个代码时 ...
- css的元素表现
块级元素和行内元素的表现: 块级元素:块级元素和父元素的宽度一致,默认情况下就是和body的宽度一样,也可以说和浏览器窗口的宽度一致,致使同一行不能再放下另外的元素,所以块级元素表现为独占一行. 块级 ...
- 移动端地区选择mobile-select-area插件的使用方法
顾名思义,mobile-select-area插件就是使用在移动端上的进行地区选择的插件,而且使用方法简单,我就说我是怎么用的吧 一.准备工作 首先肯定要下载插件对应的css+js文件, 当你下载好这 ...
- ios 9 http
记录: <key>NSAppTransportSecurity</key> <dict> <key>NSAllowsArbitraryLo ...
- MapReduce:Shuffle过程详解
1.Map任务处理 1.1 读取HDFS中的文件.每一行解析成一个<k,v>.每一个键值对调用一次map函数. <0,hello you> & ...