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

  • 相关阅读:
    Oracle
    注解
    java 算法实现
    ConcurrentHashMap
    hashMap 1.8
    hashmap 1.7
    MySQL优化
    Mysql面试题
    tmux
    mysql 复制表结构、表数据的方法
  • 原文地址:https://www.cnblogs.com/Michael2397/p/7867368.html
Copyright © 2011-2022 走看看