Top Description Methods
org.springframework.messaging.handler.annotation

public @Interface Payload

extends Annotation
Annotations
@Target:PARAMETER, METHOD
@Retention:RUNTIME
@Documented
Imports
java.lang.annotation.Documented, .ElementType, .Retention, .RetentionPolicy, .Target, org.springframework.core.annotation.AliasFor, org.springframework.messaging.converter.MessageConverter

Annotation that binds a method parameter to the payload of a message. Can also be used to associate a payload to a method invocation. The payload may be passed through a MessageConverter to convert it from serialized form with a specific MIME type to an Object matching the target method parameter.
Authors
Rossen Stoyanchev, Sam Brannen
Since
4.0

Method Summary

Modifier and TypeMethod and Description
public String
expression()

A SpEL expression to be evaluated against the payload object as the root context.

public boolean
required()

Whether payload content is required.

public String
value()

Alias for expression.

Inherited from java.lang.annotation.Annotation:
annotationTypeequalshashCodetoString

Method Detail

expressionback to summary
public String expression()

A SpEL expression to be evaluated against the payload object as the root context.

This attribute may or may not be supported depending on whether the message being handled contains a non-primitive Object as its payload or is in serialized form and requires message conversion.

This attribute is not supported for:

  • STOMP over WebSocket messages
  • RSocket interface client
Annotations
@AliasFor:value
Since
4.2
requiredback to summary
public boolean required()

Whether payload content is required.

Default is true, leading to an exception if there is no payload. Switch to false to have null passed when there is no payload.

valueback to summary
public String value()

Alias for expression.

Annotations
@AliasFor:expression