Spring的Bean加载的过程?
- 通过反射实例化Bean;
- 对bean的依赖属性进行填充
- 如果实现了BeanNameAware接口,调用setBeanName设置Bean对象的ID或者Name;
- 如果实现BeanFactoryAware接口,调用setBeanFactory 设置BeanFactory;
- 如果实现ApplicationContextAware,调用setApplicationContext设置ApplicationContext
- 调用BeanPostProcessor的预先初始化方法;
- 调用InitializingBean的afterPropertiesSet()方法;
- 调用定制init-method方法;
- 调用BeanPostProcessor的后初始化方法;