Skip to content

Commit c36314d

Browse files
GH-3366: Document HTTP request mapping limitation (#3382)
* GH-3366: Document HTTP request mapping limitation Fixes #3366 The same path cannot be mapped both Spring Integration and MVC ways * Doc Polishing Co-authored-by: Gary Russell <grussell@pivotal.io>
1 parent dbb2f9c commit c36314d

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

spring-integration-http/src/main/java/org/springframework/integration/http/inbound/IntegrationRequestMappingHandlerMapping.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import java.util.HashMap;
2222
import java.util.List;
2323
import java.util.Map;
24+
import java.util.Set;
2425
import java.util.concurrent.atomic.AtomicBoolean;
2526

2627
import javax.servlet.http.HttpServletRequest;
@@ -78,6 +79,14 @@
7879
* register HTTP endpoints at runtime for dynamically declared beans, e.g. via
7980
* {@link org.springframework.integration.dsl.context.IntegrationFlowContext}, and unregister
8081
* them during the {@link BaseHttpInboundEndpoint} destruction.
82+
*<p>
83+
* This class extends the Spring MVC {@link RequestMappingHandlerMapping} class, inheriting
84+
* most of its logic, especially {@link #handleNoMatch(Set, String, HttpServletRequest)},
85+
* which throws a specific {@code 4xx} error for the HTTP response, when mapping doesn't match
86+
* for some reason, preventing calls to any remaining mapping handlers in the application context.
87+
* For this reason, configuring the same path for both Spring Integration and
88+
* Spring MVC request mappings (e.g. `POST` in one and `GET` in the other) is not supported;
89+
* the MVC mapping will not be found.
8190
*
8291
* @author Artem Bilan
8392
* @author Gary Russell

src/reference/asciidoc/http.adoc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,9 @@ The following example shows how to do so:
349349

350350
For more information regarding handler mappings, see https://docs.spring.io/spring/docs/current/spring-framework-reference/web.html[the Spring Framework Web Servlet documentation] or https://docs.spring.io/spring/docs/current/spring-framework-reference/web-reactive.html[the Spring Framework Web Reactive documentation].
351351

352+
IMPORTANT: The `IntegrationRequestMappingHandlerMapping` extends the Spring MVC `RequestMappingHandlerMapping` class, inheriting most of its logic, especially `handleNoMatch(Set, String, HttpServletRequest)`, which throws a specific `4xx` error for the HTTP response, when mapping doesn't match for some reason, preventing calls to any remaining mapping handlers in the application context.
353+
For this reason, configuring the same path for both Spring Integration and Spring MVC request mappings (e.g. `POST` in one and `GET` in the other) is not supported; the MVC mapping will not be found..
354+
352355
[[http-cors]]
353356
==== Cross-origin Resource Sharing (CORS) Support
354357

0 commit comments

Comments
 (0)