如何在Spring集成中使用JAVA配置创建http出站网关? [英] How can I create http outbound-gateway with JAVA config in Spring integration?
本文介绍了如何在Spring集成中使用JAVA配置创建http出站网关?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有以下http出站网关.如何使用Java Config或Spring DSL进行此配置?
I have the following http outbound gateway. How can I do this configuration with Java Config or 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;
}
这篇关于如何在Spring集成中使用JAVA配置创建http出站网关?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文