BeanFactoryPostProcessor和BeanPostProcessor
1. BeanFactoryPostProcessor调用(见AbstractApplicationContext.refresh):
>> 创建DefaultListableBeanFactory --> loadBeanDefinitions
1)BeanDefinitionRegistryPostProcessor.postProcessBeanDefinitionRegistry(编码注册)
2)BeanDefinitionRegistryPostProcessor.postProcessBeanDefinitionRegistry(配置注册):PriorityOrdered排序 --> Ordered排序 --> 无序
3)BeanFactoryPostProcessor.postProcessBeanFactory(编码注册):BeanDefinitionRegistryPostProcessor --> BeanFactoryPostProcessor
4)BeanFactoryPostProcessor.postProcessBeanFactory(配置注册):PriorityOrdered排序 --> Ordered排序 --> 无序
2. BeanPostProcessor注册:
1)PriorityOrdered排序 --> Ordered排序 --> 无序
2)MergedBeanDefinitionPostProcessor
3. BeanPostProcessor调用(见DefaultListableBeanFactory.createBean):
1)InstantiationAwareBeanPostProcessor.applyBeanPostProcessorsBeforeInstantiation(resolveBeforeInstantiation)
>> 获取bean --> 6
>> createBeanInstance(默认:CglibSubclassingInstantiationStrategy.instantiate) --> 2
2)MergedBeanDefinitionPostProcessor.postProcessMergedBeanDefinitioInstantiationAwareBeanPostProcessor
3)InstantiationAwareBeanPostProcessor.postProcessAfterInstantiation
>> autowireByName / autowireByType
4)InstantiationAwareBeanPostProcessor.postProcessPropertyValues
>> applyPropertyValues
5)BeanPostProcessor.postProcessBeforeInitialization(@postConstruct)
>> InitializingBean.afterPropertiesSet --> invokeInitMethod(init-method )
6)BeanPostProcessor.postProcessAfterInitialization
>> 单实例(容器初始化完成):SmartInitializingSingleton.afterSingletonsInstantiated
4. 应用
1)BeanFactoryPostProcessor
2)BeanPostProcessor:ApplicationContextAwareProcessor、InitDestroyAnnotationBeanPostProcessor、AutowiredAnnotationBeanPostProcessor、AOP
BeanFactoryPostProcessor和BeanPostProcessor的更多相关文章
- spring 后置处理器BeanFactoryPostProcessor和BeanPostProcessor的用法和区别
主要区别就是: BeanFactoryPostProcessor可以修改BEAN的配置信息而BeanPostProcessor不能,下面举个例子说明 BEAN类: package com.spring ...
- Spring的BeanFactoryPostProcessor和BeanPostProcessor
转载:http://blog.csdn.net/caihaijiang/article/details/35552859 BeanFactoryPostProcessor和BeanPostProces ...
- BeanFactoryPostProcessor vs BeanPostProcessor
BeanFactoryPostProcessors affect BeanDefinition objects because they are run right after your config ...
- Spring点滴十一:Spring中BeanFactoryPostProcessor和BeanPostProcessor区别
Spring中BeanFactoryPostProcessor和BeanPostProcessor都是Spring初始化bean时对外暴露的扩展点.两个接口从名字看起来很相似,但是作用及使用场景却不同 ...
- spring扩展点之一:BeanFactoryPostProcessor和BeanPostProcessor
一.BeanFactoryPostProcessor和BeanPostProcessor的区别 BeanFactoryPostProcessor和BeanPostProcessor都是spring初始 ...
- Spring Boot源码(五):BeanFactoryPostProcessor和BeanPostProcessor
BeanFactoryPostProcessor是spring BeanFactory加载Bean后调用, BeanPostProcessor是Bean初始化前后调用. BeanFactoryPost ...
- Spring 钩子之BeanFactoryPostProcessor和BeanPostProcessor的源码学习,FactoryBean
BeanFactoryPostProcessor 是用于增强BeanFactory的(例如可以增强beanDefination), BeanPostProcessor是用于增强bean的,而Facto ...
- spring BeanPostProcessor
BeanPostProcessor spring使用BeanPostProcessor接口来处理生命周期的回调 BeanPostProcessor接口定义的两个方法,分别在bean的(实例化配置和初始 ...
- 简单比较init-method,afterPropertiesSet和BeanPostProcessor
一.简单介绍 1.init-method方法,初始化bean的时候执行,可以针对某个具体的bean进行配置.init-method需要在applicationContext.xml配置文档中bean的 ...
随机推荐
- python3爬虫.3.下载网页图片
目标,豆瓣读书, 下载页面书籍图片. import urllib.request import re #使用正则表达式 def getJpg(date): jpgList = re.findall(r ...
- docker使用现有容器生成新的镜像
/*运行docker run后 --则进入该容器里了 我们做一些变更,比如安装一些东西 ,然后针对这个容器进行创建新的镜像 */ 基本形式: docker commit -m "change ...
- JS日历控件特效代码layDate
https://www.js-css.cn/a/jscode/date/2015/0405/1461.html
- redhat5.5 x64 安装oracle 11g
http://www.cnblogs.com/jamesf/p/4769086.html http://blog.csdn.net/yakson/article/details/9012129
- What does “=>” mean in import in scala?(转自StackOverflow问答)
As others have mentioned, it's an import rename. There is however one further feature that proves ...
- mybatis注解使用
spring整合mybatis时,要使用mybatis的注解,需要spring-config.xml文件中添加下述配置: <!--下述配置指明了我们的Mapper,即Dao,在相应的包里也就可以 ...
- MySQL 操作总结
1. 数据库级别操作 1.1 创建数据库 CREATE DATABASE db1 default charset utf8 collate utf8_general_ci; 1.2 删除数据库 DRO ...
- C# 随笔 【ToList().Foreach()和Foreach()】
1. 最近在做一个Socket通讯的例子,但是如果使用UTF-8编码传输中文的话取和的会不一样.早上做了测试 . string str = "a我..";看代码中间是一个英文,一个 ...
- ~Delphi const 杂谈~
来自:http://www.cnblogs.com/tibetwolf/articles/1785744.html ------------------------------------------ ...
- Spring学习-理解IOC和依赖注入
最近刚买了一本介绍ssm框架的书,里面主要对Mybatis.spring.springmvc和redis做了很多的讲解,个人觉得虽然有的内容我看不懂,但是整体上还是不错的.最近正在学习中,一边学习一边 ...