Class ApplicationEvent

java.lang.Object
java.util.EventObject
org.springframework.context.ApplicationEvent
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
AbstractSubProtocolEvent, ApplicationContextEvent, BrokerAvailabilityEvent, PayloadApplicationEvent, RequestHandledEvent, TestContextEvent

public abstract class ApplicationEvent extends EventObject
Class to be extended by all application events. Abstract as it doesn't make sense for generic events to be published directly.
Author:
Rod Johnson, Juergen Hoeller
See Also:
  • Constructor Details

    • ApplicationEvent

      public ApplicationEvent(Object source)
      Create a new ApplicationEvent with its timestamp set to System.currentTimeMillis().
      Parameters:
      source - the object on which the event initially occurred or with which the event is associated (never null)
      See Also:
    • ApplicationEvent

      public ApplicationEvent(Object source, Clock clock)
      Create a new ApplicationEvent with its timestamp set to the value returned by Clock.millis() in the provided Clock.

      This constructor is typically used in testing scenarios.

      Parameters:
      source - the object on which the event initially occurred or with which the event is associated (never null)
      clock - a clock which will provide the timestamp
      Since:
      5.3.8
      See Also:
  • Method Details