前言-阅读源码有利于陶冶情操,本文承接前文Spring源码情操陶冶-AbstractApplicationContext#obtainFreshBeanFactory 前文提到最关键的地方是解析bean xml配置文件,废话不多说,直接上代码清单 //正如官方注释所说,解析import标签.alias标签.bean标签和自定义的标签 protected void parseBeanDefinitions(Element root, BeanDefinitionParserDelegate del…
前言-阅读源码有利于陶冶情操,本文承接前文Spring源码情操陶冶-AbstractApplicationContext 约束: 本文指定contextClass为默认的XmlWebApplicationContext 从属AbstractApplicationContext#refresh方法 AbstractApplicationContext#obtainFreshBeanFactory 该方法主要完成创建Bean工厂,涉及到解析spring文件,代码清单如下 protected Conf…
本文承接前文Spring源码情操陶冶-DefaultBeanDefinitionDocumentReader#parseBeanDefinitions,特开辟出一块新地来啃啃这块有意思的骨头 自定义节点的类型 我们常用的可分为spring/springmvc两类 spring常用的节点类型 context类型 context-component-scan-扫描包内的所有class类并注册为beanDefinition到spring上下文 context-property-placeholder-…
承接前文Spring源码情操陶冶-AbstractApplicationContext#registerListeners 约定web.xml配置的contextClass为默认值XmlWebApplicationContext 直接源码AbstractRefreshableWebApplicationContext#finishBeanFactoryInitialization /** * Finish the initialization of this context's bean fac…
承接前文Spring源码情操陶冶-AbstractApplicationContext#onRefresh 约定web.xml配置的contextClass为默认值XmlWebApplicationContext 直接源码AbstractRefreshableWebApplicationContext#registerListeners /** * Add beans that implement ApplicationListener as listeners. * Doesn't affec…
承接前文Spring源码情操陶冶-AbstractApplicationContext#initApplicationEventMulticaster 约定web.xml配置的contextClass为默认值XmlWebApplicationContext 直接源码AbstractRefreshableWebApplicationContext#onRefresh /** * Initialize the theme capability. */ protected void onRefresh…
承接前文Spring源码情操陶冶-AbstractApplicationContext#initMessageSource 约定web.xml配置的contextClass为默认值XmlWebApplicationContext 瞧瞧官方注释 /** * Initialize the ApplicationEventMulticaster. * Uses SimpleApplicationEventMulticaster if none defined in the context. * @se…
承接前文Spring源码情操陶冶-AbstractApplicationContext#registerBeanPostProcessors 约定web.xml配置的contextClass为默认值XmlWebApplicationContext 瞧瞧官方注释 /** * Initialize the MessageSource. * Use parent's if none defined in this context. */ 初始化MessageSource消息源,如果beanFactor…
承接前文Spring源码情操陶冶-AbstractApplicationContext#invokeBeanFactoryPostProcessors 瞧瞧官方注释 /** * Instantiate and invoke all registered BeanPostProcessor beans, * respecting explicit order if given. * <p>Must be called before any instantiation of application…
阅读源码有利于陶冶情操,承接前文Spring源码情操陶冶-AbstractApplicationContext#postProcessBeanFactory 约定:web.xml中配置的contextClass为XmlWebApplicationContext 瞧瞧官方注释 /** * Instantiate and invoke all registered BeanFactoryPostProcessor beans, * respecting explicit order if given…