1. 从启动类开始
public static void main(String[] args) {// Run the SpringApplication class with the Application class as the first argumentSpringApplication.run(Application.class, args);}
2. bean 实例化
// SpringAplication row=1294,1295
run()
// SpringAplication row=1035,1036
run()
// SpringAplication row=293,308
refreshContext(context);
// SpringAplication row=404,408
refresh(context);
// SpringAplication row=733,734
applicationContext.refresh();
//ConfigurationApplicationContext rw=201
refresh()
// AbstractApplicationContext row=545,583
finishBeanFactoryInitialization(beanFactory);
// AbstractApplicationContext row=890,918
beanFactory.preInstantiateSingletons();
// ConfigurationListableBeanFactory 160
preInstantiateSingletons();
// DefaultListableBeanFactory row=922,955
preInstantiateSingletons();
// AbstractBeanFactory row=207,208
getBean();
// AbstractBeanFactory row=248,374
goGetBean()
//AbstractBeanFactory row=2003
createBean()
3. bean 依赖注入
接上面
//AbstractBeanFactory row=2003
createBean()
//AbstractAutowireCapableBeanFactory row=503,542
createBean()
//AbstractAutowireCapableBeanFactory row=573,582
doCreateBean()
//AbstractAutowireCapableBeanFactory row=1180,1222
createBeanInstance()
//AbstractAutowireCapableBeanFactory row=1369,1372
autowireConstructor()
// ConstructorResolver row=127,181
autowireConstructor()
// ConstructorResolver row=300,311
instantiate()
4. 删除实例及其依赖实例
// DefaultSingletonBeanRegistry row=550
destroySingleton()
// DefaultSingletonBeanRegistry row=568
destroyBean()
// AbstractFactoryBean row=197
destroy()
优化中…