From 07e0d0c806685a2e13dfdb76b3713f6769ca08ed Mon Sep 17 00:00:00 2001 From: Oleg Zhurakousky Date: Fri, 10 Dec 2010 13:03:53 -0500 Subject: [PATCH] INT-1673 added SpEL documentation for @Header, updated @Header javadocs --- docs/src/reference/docbook/configuration.xml | 7 +++++++ .../org/springframework/integration/annotation/Header.java | 5 ++++- .../ChatMessageOutboundChannelAdapterParserTests.java | 5 ----- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/docs/src/reference/docbook/configuration.xml b/docs/src/reference/docbook/configuration.xml index 125b1c0173..fb16cde727 100644 --- a/docs/src/reference/docbook/configuration.xml +++ b/docs/src/reference/docbook/configuration.xml @@ -250,6 +250,13 @@ public class FooService { } } + + + + The value of the annotation can also be a SpEL expression (e.g., 'payload.getCustomerId()') which is quite useful when + the name of the header has to be dynamically computed. It also provides an optional 'required' property which + specifies whether the attribute value must be available within the header. The default value for 'required' is true. + For several of these annotations, when a Message-handling method returns a non-null value, the endpoint will diff --git a/spring-integration-core/src/main/java/org/springframework/integration/annotation/Header.java b/spring-integration-core/src/main/java/org/springframework/integration/annotation/Header.java index 084cc697a5..5c54bb2209 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/annotation/Header.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/annotation/Header.java @@ -25,7 +25,10 @@ import java.lang.annotation.Target; /** * Annotation indicating that a method parameter's value should be * retrieved from the message headers. The value of the annotation - * provides the header name, and the optional 'required' property + * can either be a header name (e.g., 'foo') or SpEL expression + * (e.g., 'payload.getCustomerId()') which is quite useful when + * the name of the header has to be dynamically computed. It also + * provides an optional 'required' property which * specifies whether the attribute value must be available within * the header. The default value for 'required' is true. * diff --git a/spring-integration-xmpp/src/test/java/org/springframework/integration/xmpp/config/ChatMessageOutboundChannelAdapterParserTests.java b/spring-integration-xmpp/src/test/java/org/springframework/integration/xmpp/config/ChatMessageOutboundChannelAdapterParserTests.java index 184862f29c..db65bb7952 100644 --- a/spring-integration-xmpp/src/test/java/org/springframework/integration/xmpp/config/ChatMessageOutboundChannelAdapterParserTests.java +++ b/spring-integration-xmpp/src/test/java/org/springframework/integration/xmpp/config/ChatMessageOutboundChannelAdapterParserTests.java @@ -18,14 +18,9 @@ package org.springframework.integration.xmpp.config; import static junit.framework.Assert.assertEquals; import static junit.framework.Assert.assertTrue; -import static org.mockito.Mockito.mock; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; -import org.jivesoftware.smack.Chat; -import org.jivesoftware.smack.ChatManager; -import org.jivesoftware.smack.MessageListener; import org.jivesoftware.smack.XMPPConnection; import org.junit.Test; import org.junit.runner.RunWith;