|
此版本仍在开发中,尚未被视为稳定版本。对于最新的稳定版本,请使用 Spring Integration 6.3.4! |
|
此版本仍在开发中,尚未被视为稳定版本。对于最新的稳定版本,请使用 Spring Integration 6.3.4! |
所有 EIP 方法都有一个变体,该变体应用 lambda 参数来为实例提供选项:、、 、 和其他实例。
它们中的每一个都有泛型参数,因此它允许您在上下文中配置终端节点,甚至配置终端节点,如下例所示:IntegrationFlowBuilderAbstractEndpointSmartLifecyclePollerMetadatarequest-handler-advice-chainMessageHandler
@Bean
public IntegrationFlow flow2() {
return IntegrationFlow.from(this.inputChannel)
.transformWith(t -> t
.transformer(new PayloadSerializingTransformer())
.autoStartup(false)
.id("payloadSerializingTransformer"))
.transformWith(t -> t
.transformer((Integer p) -> p * 2)
.advice(expressionAdvice()))
.get();
}
此外,还提供了一种方法,允许您使用给定的 bean 名称而不是生成的 bean 名称注册端点 bean。EndpointSpecid()
如果 the 被引用为 bean,那么如果该方法存在于 DSL 定义中,那么任何现有的配置都将被覆盖:MessageHandleradviceChain.advice()
@Bean
public TcpOutboundGateway tcpOut() {
TcpOutboundGateway gateway = new TcpOutboundGateway();
gateway.setConnectionFactory(cf());
gateway.setAdviceChain(Collections.singletonList(fooAdvice()));
return gateway;
}
@Bean
public IntegrationFlow clientTcpFlow() {
return f -> f
.handle(tcpOut(), e -> e.advice(testAdvice()))
.transform(Transformers.objectToString());
}
它们不会合并,在这种情况下只使用 bean。testAdvice()