在加载Bean时需要经历11个步骤
- instantiate bean 对象实例化
- 属性注入
- 如果Bean 实现了BeanNameAware 执行setBeanName 方法
- 如果Bean实现了BeanFactoryAware 或者ApplicationContextAware 可执行设置工厂setBeanFactory 方法或者上下文对象setApplicationContext方法
- 如果Bean实现了BeanPostProcess 执行postProcessBeforeInitialization方法
- 如果Bean实现了InitalizingBean 执行afterProperties方法
- 调用< bean init-method=" ···· " >所指定的方法
- 如果Bean实现了BeanPostProcess 执行postProcessAfterInitialization方法
- 执行处理业务代码
- 如果实现了DisposableBean执行destroy方法
- 调用 < bean destroy-method=" ···· " >所指定的方法