注释类型 Payload
@Target({PARAMETER,METHOD}) @Retention(RUNTIME) @Documented public @interface Payload
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 aMessageConverterto convert it from serialized form with a specific MIME type to an Object matching the target method parameter.- 从以下版本开始:
- 4.0
- 作者:
- Rossen Stoyanchev, Sam Brannen
可选元素概要
可选元素 修饰符和类型 可选元素 说明 StringexpressionA SpEL expression to be evaluated against the payload object as the root context.booleanrequiredWhether payload content is required.StringvalueAlias forexpression().
元素详细资料
value
@AliasFor("expression") String value
Alias forexpression().- 默认值:
- ""
expression
@AliasFor("value") 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.
When processing STOMP over WebSocket messages this attribute is not supported.
- 从以下版本开始:
- 4.2
- 默认值:
- ""
required
boolean required
Whether payload content is required.Default is
true, leading to an exception if there is no payload. Switch tofalseto havenullpassed when there is no payload.- 默认值:
- true