Class EventPublishingRunListener

java.lang.Object
org.springframework.boot.context.event.EventPublishingRunListener
All Implemented Interfaces:
SpringApplicationRunListener, org.springframework.core.Ordered

public class EventPublishingRunListener extends Object implements SpringApplicationRunListener, org.springframework.core.Ordered
SpringApplicationRunListener to publish SpringApplicationEvents.

Uses an internal ApplicationEventMulticaster for the events that are fired before the context is actually refreshed.

Since:
1.0.0
  • Field Summary

    Fields inherited from interface org.springframework.core.Ordered

    HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    contextLoaded(org.springframework.context.ConfigurableApplicationContext context)
    Called once the application context has been loaded but before it has been refreshed.
    void
    contextPrepared(org.springframework.context.ConfigurableApplicationContext context)
    Called once the ApplicationContext has been created and prepared, but before sources have been loaded.
    void
    environmentPrepared(ConfigurableBootstrapContext bootstrapContext, org.springframework.core.env.ConfigurableEnvironment environment)
    Called once the environment has been prepared, but before the ApplicationContext has been created.
    void
    failed(org.springframework.context.ConfigurableApplicationContext context, Throwable exception)
    Called when a failure occurs when running the application.
    int
     
    void
    ready(org.springframework.context.ConfigurableApplicationContext context, Duration timeTaken)
    Called immediately before the run method finishes, when the application context has been refreshed and all CommandLineRunners and ApplicationRunners have been called.
    void
    started(org.springframework.context.ConfigurableApplicationContext context, Duration timeTaken)
    The context has been refreshed and the application has started but CommandLineRunners and ApplicationRunners have not been called.
    void
    Called immediately when the run method has first started.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

  • Method Details

    • getOrder

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

      public void starting(ConfigurableBootstrapContext bootstrapContext)
      Description copied from interface: SpringApplicationRunListener
      Called immediately when the run method has first started. Can be used for very early initialization.
      Specified by:
      starting in interface SpringApplicationRunListener
      Parameters:
      bootstrapContext - the bootstrap context
    • environmentPrepared

      public void environmentPrepared(ConfigurableBootstrapContext bootstrapContext, org.springframework.core.env.ConfigurableEnvironment environment)
      Description copied from interface: SpringApplicationRunListener
      Called once the environment has been prepared, but before the ApplicationContext has been created.
      Specified by:
      environmentPrepared in interface SpringApplicationRunListener
      Parameters:
      bootstrapContext - the bootstrap context
      environment - the environment
    • contextPrepared

      public void contextPrepared(org.springframework.context.ConfigurableApplicationContext context)
      Description copied from interface: SpringApplicationRunListener
      Called once the ApplicationContext has been created and prepared, but before sources have been loaded.
      Specified by:
      contextPrepared in interface SpringApplicationRunListener
      Parameters:
      context - the application context
    • contextLoaded

      public void contextLoaded(org.springframework.context.ConfigurableApplicationContext context)
      Description copied from interface: SpringApplicationRunListener
      Called once the application context has been loaded but before it has been refreshed.
      Specified by:
      contextLoaded in interface SpringApplicationRunListener
      Parameters:
      context - the application context
    • started

      public void started(org.springframework.context.ConfigurableApplicationContext context, Duration timeTaken)
      Description copied from interface: SpringApplicationRunListener
      The context has been refreshed and the application has started but CommandLineRunners and ApplicationRunners have not been called.
      Specified by:
      started in interface SpringApplicationRunListener
      Parameters:
      context - the application context.
      timeTaken - the time taken to start the application or null if unknown
    • ready

      public void ready(org.springframework.context.ConfigurableApplicationContext context, Duration timeTaken)
      Description copied from interface: SpringApplicationRunListener
      Called immediately before the run method finishes, when the application context has been refreshed and all CommandLineRunners and ApplicationRunners have been called.
      Specified by:
      ready in interface SpringApplicationRunListener
      Parameters:
      context - the application context.
      timeTaken - the time taken for the application to be ready or null if unknown
    • failed

      public void failed(org.springframework.context.ConfigurableApplicationContext context, Throwable exception)
      Description copied from interface: SpringApplicationRunListener
      Called when a failure occurs when running the application.
      Specified by:
      failed in interface SpringApplicationRunListener
      Parameters:
      context - the application context or null if a failure occurred before the context was created
      exception - the failure