このバージョンはまだ開発中であり、まだ安定しているとは見なされていません。最新の安定バージョンについては、Spring Integration 6.5.3 を使用してください!

#xpath SpEL 関数

Spring Integration は、バージョン 3.0 以降、XPathUtils.evaluate(…​) 静的メソッドを呼び出すビルトイン #xpath SpEL 関数を提供します。このメソッドは org.springframework.xml.xpath.XPathExpression に委譲します。次のリストは、いくつかの使用例を示しています。

<transformer expression="#xpath(payload, '/name')"/>

<filter expression="#xpath(payload, headers.xpath, 'boolean')"/>

<splitter expression="#xpath(payload, '//book', 'document_list')"/>

<router expression="#xpath(payload, '/person/@age', 'number')">
    <mapping channel="output1" value="16"/>
    <mapping channel="output2" value="45"/>
</router>

#xpath() は、XPath 評価の結果を変換するための 3 番目のオプションのパラメーターもサポートします。文字列定数(stringbooleannumbernodenode_listdocument_list)または org.springframework.xml.xpath.NodeMapper インスタンスのいずれかです。デフォルトでは、#xpath SpEL 関数は XPath 評価の String 表現を返します。

To enable the #xpath SpEL function, you can add the spring-integration-xml.jar to the classpath. You do not need to declare any components from the Spring Integration XML Namespace.

詳細については、" ` Spring 式言語 (SpEL)" を参照してください。