怎么使用DeBug深入源码
Posted Nothing_doit
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了怎么使用DeBug深入源码相关的知识,希望对你有一定的参考价值。
使用DeBug深入Spring-IOC容器的创建过程
1.写出测试程序并打上断点
2.进入Debug模式
3.Debug界面认识
4.享受Debug模式,若没有源码,自行导入
IOC容器初始化的核心代码
AbstractApplicationContext
public void refresh() throws BeansException, IllegalStateException synchronized ( this . startupShutdownMonitor ) // Prepare this context for refreshing. prepareRefresh(); // Tell the subclass to refresh the internal bean factory. ConfigurableListableBeanFactory beanFactory = obtainFreshBeanFactory(); // Prepare the bean factory for use in this context. prepareBeanFactory(beanFactory); try // Allows post-processing of the bean factory in context subclasses. postProcessBeanFactory(beanFactory); // Invoke factory processors registered as beans in the context. invokeBeanFactoryPostProcessors(beanFactory); // Register bean processors that intercept bean creation. registerBeanPostProcessors(beanFactory); // Initialize message source for this context. initMessageSource(); // Initialize event multicaster for this context. initApplicationEventMulticaster(); // Initialize other special beans in specific context subclasses. onRefresh(); // Check for listener beans and register them. registerListeners(); // Instantiate all remaining (non-lazy-init) singletons. finishBeanFactoryInitialization(beanFactory); // Last step: publish corresponding event. finishRefresh(); catch (BeansException ex) // Destroy already created singletons to avoid dangling resources. destroyBeans(); // Reset 'active' flag. cancelRefresh(ex); // Propagate exception to caller. throw ex;
以上是关于怎么使用DeBug深入源码的主要内容,如果未能解决你的问题,请参考以下文章
扒开Redisson的小棉袄,Debug深入剖析分布式锁之可重入锁No.1