我有以下http入站通道适配器。如何使用Java Config或Spring DSL进行此配置?
<int-http:inbound-channel-adapter
channel="api_app_integration_request_channel"
supported-methods="PUT"
path="/process/ticket"
request-payload-type="*.model.Ticket"
header-mapper="headerMapper"
error-channel="internal-client-rest-ticket-error-channel"
>
<int-http:request-mapping consumes="application/json" />
</int-http:inbound-channel-adapter>发布于 2021-08-31 21:31:43
参见Spring Integration Reference Manual:
Java DSL:https://docs.spring.io/spring-integration/docs/current/reference/html/dsl.html#java-dsl
HTTP模块规范:https://docs.spring.io/spring-integration/docs/current/reference/html/http.html#http-java-config
您的特定示例可以转换为此IntegrationFlow
@Bean
public IntegrationFlow myHttpFlow() {
return IntegrationFlows
.from(Http.inboundChannelAdapter("/process/ticket")
.requestMapping(r -> r
.methods(HttpMethod.PUT)
.consumes("application/json"))
.requestPayloadType(model.Ticket.class)
.headerMapper(headerMapper))
.channel("api_app_integration_request_channel")
...
.get();
}您可以添加集成端点来构建处理这些请求的逻辑,而不是添加...。
在同一个HTTP章节中,您可以找到如何将HttpRequestHandlingMessagingGateway配置为纯@Bean。
https://stackoverflow.com/questions/69005281
复制相似问题