如何从spring Integration中的表达式调用类的方法 [英] How to call a method of a class from expression in spring Integration
本文介绍了如何从spring Integration中的表达式调用类的方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何从 spring 集成表达式调用方法:
How to invoke a method from spring integration EXPRESSION :
<int:chain input-channel="service.activator.out">
<int:header-enricher>
<int:header name="LIST_DATA"
expression="**HERE NEEDS TO CALL A METHOD OF CLASS BY PASSING PAYLOAD**"/>
</int:header-enricher>
</int:chain>
推荐答案
如果该方法在某些 bean 上,您应该使用 beanReference
:
If that method in on some bean you should use beanReference
:
expression="@foo.method(payload, headers.bar)"
如果它是一个静态方法,你应该使用typeReference
:
If it is a static method you should use typeReference
:
expression="T(com.my.proj.Foo).method(headers.baz, payload.bar)"
并根据Message
作为表达式求值上下文的根对象提供适当的参数.
And provide appropriate parameters based on Message
as root object of expression evaluation context.
这篇关于如何从spring Integration中的表达式调用类的方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文