spring 源码中常见到的对象命名

Environment环境对象

org.springframework.core.env.Environment

PropertySource属性来源对象

org.springframework.core.env.PropertySource

org.springframework.core.env.PropertySource.StubPropertySource

桩代码 --是指只初始化部分属性的对象,可以通过识别类型 来进行未来二次加工。可以看做是占位代码

其中ServletContextPropertySource以及ServletConfigPorpertySource都是StubPropertySource的实现。

Resolver  能力提供者

org.springframework.core.env.PropertyResolver

Context  上下文

org.springframework.web.context.WebApplicationContext

Context上下文的配置地址

org.springframework.web.context.ConfigurableWebApplicationContext#setConfigLocation

指定了spring-context.xml的所在地址,来源于servletContext的contextConfigLocation参数

Loader 加载器

org.springframework.web.context.ContextLoader

 

 

初始化类对象

org.springframework.beans.BeanUtils#instantiateClass(java.lang.Class<T>)

Initializer 初始化器

org.springframework.context.ApplicationContextInitializer

globalInitializerClasses 、contextInitializerClasses 可以在web.xml中指定对应初始化类,多个以逗号或者封号隔开

需实现ApplicationContextInitializer。

spring  默认是没有定制的初始化类

customize 定制

org.springframework.core.env.StandardEnvironment#customizePropertySources

org.springframework.web.context.ContextLoader#customizeContext

 

spring 加载的关键方法

org.springframework.context.support.AbstractApplicationContext#refresh 

 

org.springframework.context.support.AbstractApplicationContext#prepareRefresh  //校验需要的属性是否都存在。

org.springframework.context.support.AbstractApplicationContext#obtainFreshBeanFactory //

 

org.springframework.beans.factory.xml.XmlBeanDefinitionReader

org.springframework.beans.factory.support.AbstractBeanDefinitionReader#loadBeanDefinitions(java.lang.String, java.util.Set<org.springframework.core.io.Resource>)

XML bean定义 读取器 

 

org.springframework.core.io.ResourceLoader

资源加载器

org.springframework.core.io.Resource

资源

 

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值