SpringBootConfiguration
    springboot注解 注解
    注解
    http://mp.weixin.qq.com/s?__biz=Mzg2MjEwMjI1Mg==&mid=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);

    1. **try **{<br /> **this**.postProcessBeanFactory(beanFactory);<br /> **this**.invokeBeanFactoryPostProcessors(beanFactory);<br /> **this**.registerBeanPostProcessors(beanFactory);<br /> **this**.initMessageSource();<br /> **this**.initApplicationEventMulticaster();<br /> **this**.onRefresh();<br /> **this**.registerListeners();<br /> **this**.finishBeanFactoryInitialization(beanFactory);<br /> **this**.finishRefresh();<br /> } **catch **(BeansException var9) {<br /> **if **(**this**.logger.isWarnEnabled()) {<br /> **this**.logger.warn(**"Exception encountered during context initialization - cancelling refresh attempt: " **+ var9);<br /> }
    2. **this**.destroyBeans();<br /> **this**.cancelRefresh(var9);<br /> **throw **var9;<br /> } **finally **{<br /> **this**.resetCommonCaches();<br /> }
    3. }<br />}

    1. public void refresh() throws BeansException, IllegalStateException {
    2. Object var1 = this.startupShutdownMonitor;
    3. synchronized(this.startupShutdownMonitor) {
    4. this.prepareRefresh();
    5. ConfigurableListableBeanFactory beanFactory = this.obtainFreshBeanFactory();
    6. this.prepareBeanFactory(beanFactory);
    7. try {
    8. this.postProcessBeanFactory(beanFactory);
    9. this.invokeBeanFactoryPostProcessors(beanFactory);
    10. this.registerBeanPostProcessors(beanFactory);
    11. this.initMessageSource();
    12. this.initApplicationEventMulticaster();
    13. this.onRefresh();
    14. this.registerListeners();
    15. this.finishBeanFactoryInitialization(beanFactory);
    16. this.finishRefresh();
    17. } catch (BeansException var9) {
    18. if (this.logger.isWarnEnabled()) {
    19. this.logger.warn("Exception encountered during context initialization - cancelling refresh attempt: " + var9);
    20. }
    21. this.destroyBeans();
    22. this.cancelRefresh(var9);
    23. throw var9;
    24. } finally {
    25. this.resetCommonCaches();
    26. }
    27. }
    28. }

    refresh()—>onRefresh()—>createWebServer()—>

    1. private void createWebServer() {
    2. WebServer webServer = this.webServer;
    3. ServletContext servletContext = getServletContext();
    4. if (webServer == null && servletContext == null) {
    5. ServletWebServerFactory factory = getWebServerFactory();
    6. this.webServer = factory.getWebServer(getSelfInitializer());
    7. }
    8. else if (servletContext != null) {
    9. try {
    10. getSelfInitializer().onStartup(servletContext);
    11. }
    12. catch (ServletException ex) {
    13. throw new ApplicationContextException("Cannot initialize servlet context",
    14. ex);
    15. }
    16. }
    17. initPropertySources();
    18. }