Spring integration 基于REST方法的Spring集成布线

Spring integration 基于REST方法的Spring集成布线,spring-integration,Spring Integration,我有几个“inthttp:inboundgateway”,我需要其中一个来根据请求提供的http方法指向不同的服务 <int-http:inbound-gateway path="....." supported-methods="POST,PUT"/> 目前,我有两个不同的端点,我正在寻找一些基于rest方法的路由器,但我没有找到关于这个主题的任何东西 有什么帮助吗?由于http方法是在消息头中自动设置的,因此您可以使用头值路由器进行此操作 像这样的 <int-http

我有几个“inthttp:inboundgateway”,我需要其中一个来根据请求提供的http方法指向不同的服务

<int-http:inbound-gateway path="....." supported-methods="POST,PUT"/>

目前,我有两个不同的端点,我正在寻找一些基于rest方法的路由器,但我没有找到关于这个主题的任何东西


有什么帮助吗?

由于http方法是在消息头中自动设置的,因此您可以使用头值路由器进行此操作

像这样的

<int-http:inbound-channel-adapter channel="input.channel"
    path="/log" supported-methods="PUT,POST" request-payload-type="java.lang.String"/>

<int:channel id="input.channel"/>

<int:header-value-router input-channel="input.channel" header-name="#{T(org.springframework.integration.http.HttpHeaders).REQUEST_METHOD">
    <int:mapping value="PUT" channel="put.input.channel"/>
    <int:mapping value="POST" channel="post.input.channel"/>
</int:header-value-router>


希望对您有所帮助

您可以为此使用头值路由器,因为http方法是在消息头中自动设置的

像这样的

<int-http:inbound-channel-adapter channel="input.channel"
    path="/log" supported-methods="PUT,POST" request-payload-type="java.lang.String"/>

<int:channel id="input.channel"/>

<int:header-value-router input-channel="input.channel" header-name="#{T(org.springframework.integration.http.HttpHeaders).REQUEST_METHOD">
    <int:mapping value="PUT" channel="put.input.channel"/>
    <int:mapping value="POST" channel="post.input.channel"/>
</int:header-value-router>

希望有帮助