Refresh方法到底干了啥?
作者:吃饭睡觉撸代码
来源:https://fangjian0423.github.io/2017/05/10/springboot-context-refresh/
前言Spring容器创建之后,会调用它的refresh方法,refresh的时候会做很多事情:比如完成配置类的解析、各种BeanFactoryPostProcessor和BeanPostProcessor的注册、国际化配置的初始化、web内置容器的构造等等。
我们来分析一下这个refresh过程。
还是以web程序为例,那么对应的Spring容器为AnnotationConfigEmbeddedWebApplicationContext。它的refresh方法调用了父类AbstractApplicationContext的refresh方法:
12345678910111213141516171819202122232425262728293031public void refresh() throws BeansException, IllegalStateException { // refresh过程只
...