Bean装配顺序:

1. Bean实例化;
2. 设置属性值init properties;
3. 如果实现了BeanNameAware接口,调用setBeanName设置Bean的ID或者Name;
4. 如果实现BeanFactoryAware接口,调用setBeanFactory 设置BeanFactory;
5. 如果实现ApplicationContextAware,调用setApplicationContext设置ApplicationContext
6. 调用BeanPostProcessor的预先初始化方法postProcessBeforeInitialization;
7. 调用InitializingBean的afterPropertiesSet()方法;
8. 调用定制init-method方法(XML configuration based,Not Code based);
9. 调用BeanPostProcessor的后初始化方法postProcessAfterInitialization;

Spring Bean的装配顺序

转载于:https://my.oschina.net/yqz/blog/1607944

相关文章:

  • 2021-10-16
  • 2021-12-12
  • 2021-09-16
  • 2022-01-21
  • 2022-01-11
  • 2022-12-23
猜你喜欢
  • 2022-01-11
  • 2022-12-23
  • 2022-12-23
  • 2021-12-03
  • 2021-12-28
  • 2021-09-14
  • 2021-08-16
相关资源
相似解决方案