diff --git a/src/reference/docbook/configuration.xml b/src/reference/docbook/configuration.xml
index 081641b2f7..9cc9a234c1 100644
--- a/src/reference/docbook/configuration.xml
+++ b/src/reference/docbook/configuration.xml
@@ -231,6 +231,8 @@ public class FooService {
@Splitter
@Transformer
@InboundChannelAdapter
+ @BridgeFrom
+ @BridgeTo
The behavior of each is described in its own chapter or section within
@@ -310,11 +312,6 @@ public class FooService {
}
}
- That provides a pure annotation-driven alternative to the XML configuration. However, it is generally recommended
- to use XML for the endpoints, since it is easier to keep track of the overall configuration in a single, external
- location (and besides the namespace-based XML configuration is not very verbose). If you do prefer to provide
- channels with the annotations however, you just need to enable a SI Annotations BeanPostProcessor. The following element should
- be added: ]]>
The processing of these annotations creates the same beans (AbstractEndpoints and
@@ -432,9 +429,139 @@ public String foo() {
The first example requires that the default poller has been declared elsewhere in the application
context.
-
- Also see .
-
+
+
+ Annotations on @Beans
+
+ Starting with version 4.0, Messaging Annotations can be configured on
+ @Bean method definitions in @Configuration classes,
+ to produce Message Endpoints based on the beans, not methods. It is useful when @Bean
+ definitions are "out of the box"
+ MessageHandlers (AggregatingMessageHandler,
+ DefaultMessageSplitter etc.), Transformers
+ (JsonToObjectTransformer, ClaimCheckOutTransformer etc.),
+ MessageSources (FileReadingMessageSource,
+ RedisStoreMessageSource etc.):
+ consoleSource() {
+ return CharacterStreamReadingMessageSource.stdin();
+ }
+
+ @Bean
+ @Transformer(inputChannel = "inputChannel", outputChannel = "httpChannel")
+ public ObjectToMapTransformer toMapTransformer() {
+ return new ObjectToMapTransformer();
+ }
+
+ @Bean
+ @ServiceActivator(inputChannel = "httpChannel")
+ public MessageHandler httpHandler() {
+ HttpRequestExecutingMessageHandler handler = new HttpRequestExecutingMessageHandler("http://foo/service");
+ handler.setExpectedResponseType(String.class);
+ handler.setOutputChannelName("outputChannel");
+ return handler;
+ }
+
+ @Bean
+ @ServiceActivator(inputChannel = "outputChannel")
+ public LoggingHandler loggingHandler() {
+ return new LoggingHandler("info");
+ }
+
+}]]>
+ The meta-annotation rules work on @Bean methods as well
+ (@MyServiceActivator above can be applied to a @Bean definition).
+
+ When using these annotations on consumer @Bean definitions, if the bean definition
+ returns an appropriate MessageHandler (depending on the
+ annotation type), attributes such as outputChannel, requiresReply etc, must
+ be set on the @Bean itself. The only annotation
+ attributes used are adviceChain, autoStartup, inputChannel, phase, poller, all
+ other attributes are for the handler.
+
+
+ When using these annotations on @Bean definitions, the inputChannel
+ must reference a declared bean; channels are not automatically declared in this case.
+
+
+
+
+ Creating a Bridge with Annotations
+
+ Starting with version 4.0, the Messaging Annotation and Java configuration provides
+ @BridgeFrom and @BridgeTo @Bean method
+ annotations to mark MessageChannel beans in
+ @Configuration classes. This is just for completeness, providing
+ a convenient mechanism to declare a
+ BridgeHandler and its Message Endpoint configuration:
+
+ These annotations can be used as meta-annotations as well.
+
+
+
+ Advising Annotated Endpoints
+
+ See .
+
+
diff --git a/src/reference/docbook/whats-new.xml b/src/reference/docbook/whats-new.xml
index 349ace4e79..521c2f1249 100644
--- a/src/reference/docbook/whats-new.xml
+++ b/src/reference/docbook/whats-new.xml
@@ -193,6 +193,26 @@
.
+
+ @BridgeFrom and @BridgeTo Annotations
+
+ Annotation and Java configuration has introduced @BridgeFrom and
+ @BridgeTo @Bean method annotations to mark
+ MessageChannel beans in
+ @Configuration classes.
+ For more information, see .
+
+
+
@@ -350,5 +370,14 @@
See for more information.
+
+ Messaging Annotations on @Bean Definitions
+
+ Messaging Annotations (@ServiceActivator, @Router,
+ @InboundChannelAdapter etc.) can now be configured on @Bean
+ definitions in @Configuration classes.
+ For more information, see .
+
+