春季集成 - 用@transformer符号注释的两个方法的两个变压器
我有一种用@transform符号注释的方法。但是,在其他情况下,需要将此变压器用于不同的输入和输出通道。让我们认为我有这样的代码:
@Transformer(inputChannel = "myInputChannel", outputChannel = "myOutputChannel")
public Message<List<DataElement>> transformMyBusiness(Message<byte[]> message) throws Throwable {
Message<List<CustomDataType>> incomingMessage = doAJob(message);
return incomingMessage;
}
我还有另一个输入通道,即MyInputChannel2和输出通道MyOutputChannel2。这些输入和输出通道将使用上述变压器,但我不想复制该代码。
如何使用@transformer注释的两个变压器使用相同的方法?
I have a method which annotated with @Transformer notation. But, in other case needs to use this this transformer for different input and output channels. Let's think that I have a code like this:
@Transformer(inputChannel = "myInputChannel", outputChannel = "myOutputChannel")
public Message<List<DataElement>> transformMyBusiness(Message<byte[]> message) throws Throwable {
Message<List<CustomDataType>> incomingMessage = doAJob(message);
return incomingMessage;
}
I have another input channel which is myInputChannel2 and output channel myOutputChannel2. These input and output channels will use the above transformer but I don't want to duplicate that code.
How can I use same method for two transformers with @Transformer annotation?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
现在是这样的:
尚无
@repeatable
对这些注释的支持,但我们确实牢记了: https://github.com/spring-projects/spring-integration/issues/sissues/2708 。也许是时候再给它了...
This is possible now like this:
There is no
@Repeatable
support for these annotations yet, but we really have it in mind: https://github.com/spring-projects/spring-integration/issues/2708.Perhaps it's time to give it a short again...