Class PayloadApplicationEvent<T>

java.lang.Object
java.util.EventObject
org.springframework.context.ApplicationEvent
org.springframework.context.PayloadApplicationEvent<T>
Type Parameters:
T - the payload type of the event
All Implemented Interfaces:
Serializable, ResolvableTypeProvider

public class PayloadApplicationEvent<T> extends ApplicationEvent implements ResolvableTypeProvider
An ApplicationEvent that carries an arbitrary payload.
Since:
4.2
Author:
Stephane Nicoll, Juergen Hoeller, Qimiao Chen
See Also:
  • Constructor Details

    • PayloadApplicationEvent

      public PayloadApplicationEvent(Object source, T payload)
      Create a new PayloadApplicationEvent, using the instance to infer its type.
      Parameters:
      source - the object on which the event initially occurred (never null)
      payload - the payload object (never null)
    • PayloadApplicationEvent

      public PayloadApplicationEvent(Object source, T payload, @Nullable ResolvableType payloadType)
      Create a new PayloadApplicationEvent based on the provided payload type.
      Parameters:
      source - the object on which the event initially occurred (never null)
      payload - the payload object (never null)
      payloadType - the type object of payload object (can be null). Note that this is meant to indicate the payload type (for example, String), not the full event type (such as PayloadApplicationEvent<&lt;String&gt;).
      Since:
      6.0
  • Method Details