INT-3516: Allow Optional<> in POJO Method Args

JIRA: https://jira.spring.io/browse/INT-3516

* Add `Optional<>` support for `@Header` in the `MessagingMethodInvokerHelper`
* Add `Optional<>` test-case
* Change `sourceCompatibility` for test to the Java 8

INT-3516: Revert SF version to 4.1.1

Add Docs on the matter

Fix WS Tests; Revert StubJavaMailSender
This commit is contained in:
Artem Bilan
2014-09-12 15:18:59 +03:00
committed by Gary Russell
parent c84b16e2b5
commit a3d8776b5c
9 changed files with 105 additions and 37 deletions

View File

@@ -53,7 +53,26 @@
not worrying about the contents of the message. Think of it as a NULL JMS message. An example use-case for such an
implementation could be a simple counter/monitor of messages deposited on the input channel.
</note>
<para>
<para>
Starting with <emphasis>version 4.1</emphasis> the framework correct converts Message properties
(<code>payload</code> and <code>headers</code>) to the Java 8 <classname>Optional</classname> POJO method
parameters:
<programlisting language="java"><![CDATA[public class MyBean {
public String computeValue(Optional<String> payload,
@Header(value="foo", required=false) String foo1,
@Header(value="foo") Optional<String> foo2) {
if (payload.isPresent()) {
String value = payload.get();
...
}
else {
...
}
}
}]]></programlisting>
</para>
<para>
Using a "ref" attribute is generally recommended if the custom Service Activator handler implementation can be reused
in other <code>&lt;service-activator&gt;</code> definitions. However if the custom Service Activator handler implementation
is only used within a single definition of the <code>&lt;service-activator&gt;</code>, you can provide an inner bean definition:

View File

@@ -230,5 +230,12 @@
See <xref linkend="resequencer"/>.
</para>
</section>
<section id="4.1-Optional-Parameter">
<title>Optional POJO method parameter</title>
<para>
Now Spring Integration consistently handles the Java 8's <classname>Optional</classname> type.
See <xref linkend="service-activator-namespace"/>.
</para>
</section>
</section>
</chapter>