我使用下面的配置在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-mapping consumes="application/json" produces="application/json"/>
</int-http:inbound-gateway>
<int:service-activator
ref="projectAPI"
method="get"
input-channel="httpProjectRequest"
output-channel="httpProjectResponce"/>我面临的问题是,当我以“/project/DFV-1.1”值发送GET请求时,我得到了DFV-1,当我在/project/DFV-1.1.1上发送get请求的键值是GET DFV-1.1
为什么它忽略了最后一个点之后的值。
发布于 2017-05-26 13:16:51
请配置一个bean,如:
<beans:bean id="integrationRequestMappingHandlerMapping"
class="org.springframework.integration.http.inbound.IntegrationRequestMappingHandlerMapping">
<beans:property name="useSuffixPatternMatch" value="false"/>
</beans:bean>useSuffixPatternMatch的描述:
/**
* Whether to use suffix pattern match (".*") when matching patterns to
* requests. If enabled a method mapped to "/users" also matches to "/users.*".
* <p>The default value is {@code true}.
* <p>Also see {@link #setUseRegisteredSuffixPatternMatch(boolean)} for
* more fine-grained control over specific suffixes to allow.
*/
public void setUseSuffixPatternMatch(boolean useSuffixPatternMatch) {https://stackoverflow.com/questions/44201342
复制相似问题