diff --git a/spring-integration-xml/src/test/java/org/springframework/integration/xml/xpath/XPathTests-context.xml b/spring-integration-xml/src/test/java/org/springframework/integration/xml/xpath/XPathTests-context.xml
index 489cbfec981..cd246ea22b6 100644
--- a/spring-integration-xml/src/test/java/org/springframework/integration/xml/xpath/XPathTests-context.xml
+++ b/spring-integration-xml/src/test/java/org/springframework/integration/xml/xpath/XPathTests-context.xml
@@ -36,4 +36,9 @@
+
+
+
+
+
diff --git a/spring-integration-xml/src/test/java/org/springframework/integration/xml/xpath/XPathTests.java b/spring-integration-xml/src/test/java/org/springframework/integration/xml/xpath/XPathTests.java
index 3382ed41a7d..9e46b76a7a5 100644
--- a/spring-integration-xml/src/test/java/org/springframework/integration/xml/xpath/XPathTests.java
+++ b/spring-integration-xml/src/test/java/org/springframework/integration/xml/xpath/XPathTests.java
@@ -77,6 +77,9 @@ public class XPathTests {
@Autowired
private MessageChannel xpathRouterInput;
+ @Autowired
+ private MessageChannel xpathRecipientsInput;
+
@Test
@SuppressWarnings("unchecked")
public void testXPathUtils() {
@@ -205,6 +208,22 @@ public void testInt3140Router() {
assertThat(receive.getPayload()).isEqualTo("X");
}
+ @Test
+ public void recipientListRouteByXpath() {
+ this.xpathRecipientsInput.send(new GenericMessage<>("2"));
+ this.xpathRecipientsInput.send(new GenericMessage<>("16"));
+
+ Message> receive = this.channelA.receive(1000);
+ assertThat(receive)
+ .extracting(Message::getPayload)
+ .isEqualTo("2");
+
+ receive = this.channelB.receive(1000);
+ assertThat(receive)
+ .extracting(Message::getPayload)
+ .isEqualTo("16");
+ }
+
public static class TestNodeMapper implements NodeMapper {
@Override
diff --git a/src/reference/antora/modules/ROOT/pages/xml/xpath-routing.adoc b/src/reference/antora/modules/ROOT/pages/xml/xpath-routing.adoc
index 42c7f4f2a60..4eb6e26f8a0 100644
--- a/src/reference/antora/modules/ROOT/pages/xml/xpath-routing.adoc
+++ b/src/reference/antora/modules/ROOT/pages/xml/xpath-routing.adoc
@@ -89,7 +89,16 @@ For example, if we want to route based on the name of the root node, we can use
evaluate-as-string="true">
+----
+
+The out-of-the-box `#xpath()` xref:spel.adoc#built-in-spel-functions[SpEL function] is also powerful enough to use with a generic router definition, including recipient list router:
+[source,xml]
+----
+
+
+
+
----
[[xpath-routing-converter]]