博客系统做网站,公众号登录入口在哪,ui设计技术培训学校,网站开发项目工作分解前言
每次有人问起SpringBoot的启动顺序是不是又来翻博客了#xff1f;其实只需要稍微查看Spring的源码即可
步骤 SpringBoot的入口org.springframework.boot.SpringApplication#run(String... args), 这里面实现了SpringBoot程序启动的所有步骤 启动事件的顺序可以看监听器…前言
每次有人问起SpringBoot的启动顺序是不是又来翻博客了其实只需要稍微查看Spring的源码即可
步骤 SpringBoot的入口org.springframework.boot.SpringApplication#run(String... args), 这里面实现了SpringBoot程序启动的所有步骤 启动事件的顺序可以看监听器的顺序定义org.springframework.boot.SpringApplicationRunListeners 或者 org.springframework.boot.SpringApplicationRunListener
附录
SpringBoot启动顺序
创建组件发送事件执行回调DefaultBootstrapContextBootstrapRegistryInitializer#initializeSpringApplicationRunListenersApplicationStartingEventConfigurableEnvironmentEnvironmentPreparedEventBannerConfigurableApplicationContextContextPreparedEventConfigurableApplicationContext#refreshContextRefreshedEventApplicationStartedEventAvailabilityChangeEvent(LivenessState.CORRECT)ApplicationRunner#runCommandLineRunner#runApplicationReadyEventAvailabilityChangeEvent(ReadinessState.ACCEPTING_TRAFFIC) 提示可通过ApplicationAvailabilityBean获取到当前LivenessState和ReadinessState的值来判断SpringBoot是否可以启动