源码


SpringBootConfiguration
springboot 注解 注解
注解
http://mp.weixin.qq.com/s?__biz=Mzg2MjEwMjI1Mg==∣=2247517350&idx=1&sn=96ab31817c899bd12254dda46b5c7e2f


public void **refresh() **throws **BeansException, IllegalStateException {
Object var1 = **this
.startupShutdownMonitor;
synchronized(this.startupShutdownMonitor) {
this.prepareRefresh();
ConfigurableListableBeanFactory beanFactory = this.obtainFreshBeanFactory();
this.prepareBeanFactory(beanFactory);

    **try **{
        **this**.postProcessBeanFactory(beanFactory);
        **this**.invokeBeanFactoryPostProcessors(beanFactory);
        **this**.registerBeanPostProcessors(beanFactory);
        **this**.initMessageSource();
        **this**.initApplicationEventMulticaster();
        **this**.onRefresh();
        **this**.registerListeners();
        **this**.finishBeanFactoryInitialization(beanFactory);
        **this**.finishRefresh();
    } **catch **(BeansException var9) {
        **if **(**this**.logger.isWarnEnabled()) {
            **this**.logger.warn(**"Exception encountered during context initialization - cancelling refresh attempt: " **+ var9);
        }

        **this**.destroyBeans();
        **this**.cancelRefresh(var9);
        **throw **var9;
    } **finally **{
        **this**.resetCommonCaches();
    }

}

}


public void refresh() throws BeansException, IllegalStateException {
        Object var1 = this.startupShutdownMonitor;
        synchronized(this.startupShutdownMonitor) {
            this.prepareRefresh();
            ConfigurableListableBeanFactory beanFactory = this.obtainFreshBeanFactory();
            this.prepareBeanFactory(beanFactory);

            try {
                this.postProcessBeanFactory(beanFactory);
                this.invokeBeanFactoryPostProcessors(beanFactory);
                this.registerBeanPostProcessors(beanFactory);
                this.initMessageSource();
                this.initApplicationEventMulticaster();
                this.onRefresh();
                this.registerListeners();
                this.finishBeanFactoryInitialization(beanFactory);
                this.finishRefresh();
            } catch (BeansException var9) {
                if (this.logger.isWarnEnabled()) {
                    this.logger.warn("Exception encountered during context initialization - cancelling refresh attempt: " + var9);
                }

                this.destroyBeans();
                this.cancelRefresh(var9);
                throw var9;
            } finally {
                this.resetCommonCaches();
            }

        }
    }

refresh()–>**onRefresh()–>**createWebServer()–>

private void createWebServer() {
   WebServer webServer = this.webServer;
   ServletContext servletContext = getServletContext();
   if (webServer == null && servletContext == null) {
      ServletWebServerFactory factory = getWebServerFactory();
      this.webServer = factory.getWebServer(getSelfInitializer());
   }
   else if (servletContext != null) {
      try {
         getSelfInitializer().onStartup(servletContext);
      }
      catch (ServletException ex) {
         throw new ApplicationContextException("Cannot initialize servlet context",
               ex);
      }
   }
   initPropertySources();
}

文章作者:   future
版权声明:   本博客所有文章除特別声明外,均采用 CC BY 4.0 许可协议。转载请注明来源 future !
 上一篇
源码 源码
org.springframework.transaction.interceptor.TransactionAspectSupport.TransactionInfo#bindToThread事务https://www.toutiao.c
2021-06-19 future
下一篇 
心语 心语
【心语】最使人颓废的往往不是前途的坎坷,而是我们信心的丧失。当全世界都在说放弃的时候,坚定地告诉自己:再试一次!
2021-03-20 future
  目录