Module bus.starter

Class SpringApplicationRunListener

java.lang.Object
org.miaixz.bus.spring.boot.SpringApplicationRunListener
All Implemented Interfaces:
EventListener, org.springframework.boot.SpringApplicationRunListener, org.springframework.context.ApplicationListener<org.springframework.boot.context.event.ApplicationStartedEvent>, org.springframework.core.Ordered

public class SpringApplicationRunListener extends Object implements org.springframework.boot.SpringApplicationRunListener, org.springframework.context.ApplicationListener<org.springframework.boot.context.event.ApplicationStartedEvent>, org.springframework.core.Ordered
实现 SpringApplicationRunListenerApplicationListener,计算启动阶段时间。 支持动态加载和性能统计,记录 JVM 启动、环境准备、上下文初始化等阶段。
Since:
Java 17+
Author:
Kimi Liu
  • Field Summary

    Fields inherited from interface org.springframework.core.Ordered

    HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
  • Constructor Summary

    Constructors
    Constructor
    Description
    SpringApplicationRunListener(org.springframework.boot.SpringApplication springApplication)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    contextLoaded(org.springframework.context.ConfigurableApplicationContext context)
     
    void
    contextPrepared(org.springframework.context.ConfigurableApplicationContext context)
     
    void
    environmentPrepared(org.springframework.boot.ConfigurableBootstrapContext bootstrapContext, org.springframework.core.env.ConfigurableEnvironment environment)
     
    int
     
    void
    onApplicationEvent(org.springframework.boot.context.event.ApplicationStartedEvent event)
     
    void
    started(org.springframework.context.ConfigurableApplicationContext context, Duration timeTaken)
     
    void
    starting(org.springframework.boot.ConfigurableBootstrapContext bootstrapContext)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.springframework.context.ApplicationListener

    supportsAsyncExecution

    Methods inherited from interface org.springframework.boot.SpringApplicationRunListener

    failed, ready
  • Constructor Details

    • SpringApplicationRunListener

      public SpringApplicationRunListener(org.springframework.boot.SpringApplication springApplication)
  • Method Details

    • starting

      public void starting(org.springframework.boot.ConfigurableBootstrapContext bootstrapContext)
      Specified by:
      starting in interface org.springframework.boot.SpringApplicationRunListener
    • environmentPrepared

      public void environmentPrepared(org.springframework.boot.ConfigurableBootstrapContext bootstrapContext, org.springframework.core.env.ConfigurableEnvironment environment)
      Specified by:
      environmentPrepared in interface org.springframework.boot.SpringApplicationRunListener
    • contextPrepared

      public void contextPrepared(org.springframework.context.ConfigurableApplicationContext context)
      Specified by:
      contextPrepared in interface org.springframework.boot.SpringApplicationRunListener
    • contextLoaded

      public void contextLoaded(org.springframework.context.ConfigurableApplicationContext context)
      Specified by:
      contextLoaded in interface org.springframework.boot.SpringApplicationRunListener
    • started

      public void started(org.springframework.context.ConfigurableApplicationContext context, Duration timeTaken)
      Specified by:
      started in interface org.springframework.boot.SpringApplicationRunListener
    • onApplicationEvent

      public void onApplicationEvent(org.springframework.boot.context.event.ApplicationStartedEvent event)
      Specified by:
      onApplicationEvent in interface org.springframework.context.ApplicationListener<org.springframework.boot.context.event.ApplicationStartedEvent>
    • getOrder

      public int getOrder()
      Specified by:
      getOrder in interface org.springframework.core.Ordered