繁体   English   中英

如何在Spring集成中使用JAVA配置创建http outbound-gateway?

[英]How can I create http outbound-gateway with JAVA config in Spring integration?

我有以下http出站网关。 如何使用Java Config或Spring DSL进行此配置?

<int-http:outbound-gateway id="test"
                           url="http://localhost:8080/"
                           http-method="POST"
                           charset="UTF-8"
                           header-mapper="soapHeaderMapper"
                           request-factory="requestFactory"
                           request-channel="inputChannel"/>
@Bean
public IntegrationFlow httpOut() {
    return IntegrationFlows.from("inputChannel")
            .handle(Http.outboundGateway("http://localhost:8080/")
                    .charset("UTF-8")
                    .httpMethod(HttpMethod.POST)
                    .headerMapper(soapHeaderMapper())
                    .requestFactory(requestFactory()), e -> e.id("test"))
            .get();
}

要么

@ServiceActivator(inputChannel="inputChannel")
@Bean(name="test")
public MessageHandler httpout() {
    HttpRequestExecutingMessageHandler handler = new ...
    ...
    return handler;
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM