Spring integration spring集成http出站适配器未解析属性

Spring integration spring集成http出站适配器未解析属性,spring-integration,Spring Integration,我们正在使用http出站适配器发出http get请求,并且我们希望在URL从envt变为envt时从属性文件中读取URL。我们还使用消息负载将一些其他路径附加到此url,但随后它会向我们提供以下错误消息:“由:java.lang.IllegalArgumentException引起:Map没有url值”。我们所需要的就是从属性文件中读取基本url,并使用有效负载生成最终url 下面是我们的示例配置 <int-http:outbound-gateway request-channe

我们正在使用http出站适配器发出http get请求,并且我们希望在URL从envt变为envt时从属性文件中读取URL。我们还使用消息负载将一些其他路径附加到此url,但随后它会向我们提供以下错误消息:“由:java.lang.IllegalArgumentException引起:Map没有url值”。我们所需要的就是从属性文件中读取基本url,并使用有效负载生成最终url

下面是我们的示例配置

    <int-http:outbound-gateway request-channel="requestChannel"
                           url="${url}/{payload}"
                           http-method="GET"
                           expected-response-type="java.lang.String"
                           >

</int-http:outbound-gateway>

实际上,URL中的
{payload}
是一个URI变量,无法自动解析。看看它是如何工作的:

UriComponentsBuilder.fromUriString(uri).buildAndExpand(uriVariables)
其中,
uriVariables
是这些URI变量的
Map

因此,在您的情况下,预期的配置必须如下所示:

<int-http:outbound-gateway request-channel="requestChannel"
                       url="${url}/{payload}"
                       http-method="GET"
                       expected-response-type="java.lang.String">
       <int-http:uri-variable name="payload" expression="payload"/>
</int-http:outbound-gateway>


您可以在中找到更多信息。

您是否尝试过属性占位符
是的,我们确实有其他正在解决的道具,除了这个。奇怪的是,若我从http适配器中删除“有效负载”部分,并只放置url位置保持器,那个么它就可以正常工作