Java 入站网关。消除位于最后一个点之后的Url参数
我使用以下配置在spring集成中创建api端点Java 入站网关。消除位于最后一个点之后的Url参数,java,spring-mvc,spring-integration,Java,Spring Mvc,Spring Integration,我使用以下配置在spring集成中创建api端点 <int-http:inbound-gateway request-channel="httpProjectRequest" reply-channel="httpProjectResponce" supported-methods="GET" path="/project/{key}" payload-expression="#pathVariables.key"> <int-http:request-
<int-http:inbound-gateway
request-channel="httpProjectRequest"
reply-channel="httpProjectResponce" supported-methods="GET"
path="/project/{key}" payload-expression="#pathVariables.key">
<int-http:request-mapping consumes="application/json" produces="application/json"/>
</int-http:inbound-gateway>
<int:service-activator
ref="projectAPI"
method="get"
input-channel="httpProjectRequest"
output-channel="httpProjectResponce"/>
我面临的问题是,当我在“key”值中的/project/DFV-1.1
URL上发送GET请求时,我得到DFV-1
,当我在/project/DFV-1.1.1
上发送GET请求时,key值中的GETDFV-1.1
为什么忽略最后一个点之后的值。请配置一个bean,如下所示:
<beans:bean id="integrationRequestMappingHandlerMapping"
class="org.springframework.integration.http.inbound.IntegrationRequestMappingHandlerMapping">
<beans:property name="useSuffixPatternMatch" value="false"/>
</beans:bean>
请将bean配置为:
<beans:bean id="integrationRequestMappingHandlerMapping"
class="org.springframework.integration.http.inbound.IntegrationRequestMappingHandlerMapping">
<beans:property name="useSuffixPatternMatch" value="false"/>
</beans:bean>
然后我总是在响应
{“timestamp”:1495809411330,“status”:404,“error”:“Not Found”,“message”:“No message available”,“path”:“/project/DFV-1”}
中得到以下消息作为对该请求的回答,请?获取请求http://localhost:8090/project/DFV-1
HeadersContent-Type
:application/json
Hm。。。对我有用。我将/test/{value}
作为网关上的模式,并发送/test/aBc-1
。实际上,payload
是aBc-1
。但是我用的是Spring5,也许这就是原因。我用的是Spring4。我已经在问题中添加了一些细节,请检查它是否会对结果造成任何差异。然后我总是在响应中得到以下消息作为对该请求的回答:{“timestamp”:1495809411330,“status”:404,“error”:“Not Found”,“message”:“No message available”,“path”:“/project/DFV-1”}
,请?获取请求http://localhost:8090/project/DFV-1
HeadersContent-Type
:application/json
Hm。。。对我有用。我将/test/{value}
作为网关上的模式,并发送/test/aBc-1
。实际上,payload
是aBc-1
。但是我用的是Spring5,也许这就是原因。我用的是Spring4。我在问题中添加了一些细节,请检查是否会对结果造成任何差异。