zoukankan      html  css  js  c++  java
  • 《SpringBoot揭秘 快速构建微服务体系》读后感(三)

     

     

     

     

     

     

     

     

     

     

    SpringApplication:SpringBoot程序启动的一站式解决方案

    深入探索SpringApplication执行流程

    因为书上的版本是1.2的,比较老,这里参考http://blog.csdn.net/zxzzxzzxz123/article/details/69941910

    public ConfigurableApplicationContext run(String... args) {
            StopWatch stopWatch = new StopWatch();
            stopWatch.start();
            ConfigurableApplicationContext context = null;
            FailureAnalyzers analyzers = null;
            configureHeadlessProperty();
            SpringApplicationRunListeners listeners = getRunListeners(args);
            listeners.starting();
            try {
                ApplicationArguments applicationArguments = new DefaultApplicationArguments(
                        args);
                ConfigurableEnvironment environment = prepareEnvironment(listeners,
                        applicationArguments);
                Banner printedBanner = printBanner(environment);
                context = createApplicationContext();
                analyzers = new FailureAnalyzers(context);
                prepareContext(context, environment, listeners, applicationArguments,
                        printedBanner);
                refreshContext(context);
                afterRefresh(context, applicationArguments);
                listeners.finished(context, null);
                stopWatch.stop();
                if (this.logStartupInfo) {
                    new StartupInfoLogger(this.mainApplicationClass)
                            .logStarted(getApplicationLog(), stopWatch);
                }
                return context;
            }
            catch (Throwable ex) {
                handleRunFailure(context, listeners, analyzers, ex);
                throw new IllegalStateException(ex);
            }
        }

     

    SpringApplicationRunListener

    SpringApplicationRunListener是一个只有SpringBoot应用的main方法执行过程中接收不同执行时点时间通知的监听者

    ApplicationListener

    ApplicationContextInitializer

     

    CommandLineRunner

  • 相关阅读:
    python 赋值操作的知识点
    python while循环语句
    python dict遍历
    python列表的切片操作
    Python做下载器需要掌握哪些
    BeautifulSoup已经安装,但仍提示No module named
    python 列表循环输出中文
    python 字符串split (string split)
    python 调用解释器
    分享python字符串去除空格的知识点
  • 原文地址:https://www.cnblogs.com/Michael2397/p/7867368.html
Copyright © 2011-2022 走看看