java 调用 spring,java-Spring Integration-应用程序代码中的调用方法

我有一个outbound-channel-adapter,其相关配置如下所示.

在FooFeedHandlerImpl中…

public void handleFeedFile(File retrievedFile) {

handleFeedFile(retrievedFile, null);

}

public void handleFeedFile(File retrievedFile, String processKey) {

if (isHandlerForFileName(retrievedFile.getName())) {

processFeed(retrievedFile, processKey);

}

}

问题:

通道适配器调用哪个handleFeedFile方法?

当我使用Spring集成在应用程序代码中调用方法时,如何确定方法参数?

谢谢你的帮助!

编辑:

我在本地运行我的进程(下载了本地SFTP服务器-http://www.coreftp.com/server/index.html),并确定已调用handleFeedFile(File file)方法.

解决方法:

Multiple parameters could create a lot of ambiguity with regards to determining the appropriate mappings. The general advice is to annotate your method parameters with @Payload and/or @Header/@Headers Below are some of the examples of ambiguous conditions which result in an Exception being raised.

和:

Multiple methods:

Message Handlers with multiple methods are mapped based on the same rules that are described above, however some scenarios might still look confusing.

如果您无法注释目标方法,则可以使用SpEL表达式来调用预期的方法:

Like many other Spring Integration components, the and also provide support for SpEL expression evaluation. To use SpEL, provide the expression string via the ‘expression’ attribute instead of providing the ‘ref’ and ‘method’ attributes that are used for method-invocation on a bean. When an Expression is evaluated, it follows the same contract as method-invocation where: the expression for an will generate a message anytime the evaluation result is a non-null value, while the expression for an must be the equivalent of a void returning method invocation.

标签:enterprise-integration,spring,java,spring-integration

来源: https://codeday.me/bug/20191028/1952048.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值