簡體   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