Interface ApplicationEventPublisher

All Known Subinterfaces:
ApplicationContext, ConfigurableApplicationContext, ConfigurableWebApplicationContext, WebApplicationContext
All Known Implementing Classes:
AbstractApplicationContext, AbstractRefreshableApplicationContext, AbstractRefreshableConfigApplicationContext, AbstractRefreshableWebApplicationContext, AbstractXmlApplicationContext, AnnotationConfigApplicationContext, AnnotationConfigWebApplicationContext, ClassPathXmlApplicationContext, FileSystemXmlApplicationContext, GenericApplicationContext, GenericGroovyApplicationContext, GenericWebApplicationContext, GenericXmlApplicationContext, GroovyWebApplicationContext, StaticApplicationContext, StaticWebApplicationContext, XmlWebApplicationContext
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface ApplicationEventPublisher
Interface that encapsulates event publication functionality.

Serves as a super-interface for ApplicationContext.

Since:
1.1.1
Author:
Juergen Hoeller, Stephane Nicoll
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Notify all matching listeners registered with this application of an event.
    default void
    Notify all matching listeners registered with this application of an application event.
  • Method Details

    • publishEvent

      default void publishEvent(ApplicationEvent event)
      Notify all matching listeners registered with this application of an application event. Events may be framework events (such as ContextRefreshedEvent) or application-specific events.

      Such an event publication step is effectively a hand-off to the multicaster and does not imply synchronous/asynchronous execution or even immediate execution at all. Event listeners are encouraged to be as efficient as possible, individually using asynchronous execution for longer-running and potentially blocking operations.

      Parameters:
      event - the event to publish
      See Also:
    • publishEvent

      void publishEvent(Object event)
      Notify all matching listeners registered with this application of an event.

      If the specified event is not an ApplicationEvent, it is wrapped in a PayloadApplicationEvent.

      Such an event publication step is effectively a hand-off to the multicaster and does not imply synchronous/asynchronous execution or even immediate execution at all. Event listeners are encouraged to be as efficient as possible, individually using asynchronous execution for longer-running and potentially blocking operations.

      Parameters:
      event - the event to publish
      Since:
      4.2
      See Also: