diff --git a/spring-web-reactive/src/main/java/org/springframework/web/reactive/result/condition/ParamsRequestCondition.java b/spring-web-reactive/src/main/java/org/springframework/web/reactive/result/condition/ParamsRequestCondition.java
index f1340b9089..ffdb0768d8 100644
--- a/spring-web-reactive/src/main/java/org/springframework/web/reactive/result/condition/ParamsRequestCondition.java
+++ b/spring-web-reactive/src/main/java/org/springframework/web/reactive/result/condition/ParamsRequestCondition.java
@@ -21,6 +21,8 @@ import java.util.Collections;
import java.util.LinkedHashSet;
import java.util.Set;
+import org.springframework.util.Assert;
+import org.springframework.util.MultiValueMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.server.ServerWebExchange;
@@ -141,12 +143,18 @@ public final class ParamsRequestCondition extends AbstractRequestCondition getRequestParams(ServerWebExchange exchange) {
+ MultiValueMap params = exchange.getRequestParams().subscribe().peek();
+ Assert.notNull(params, "Expected form data (if any) to be parsed.");
+ return params;
}
}
diff --git a/spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/AbstractHandlerMethodMapping.java b/spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/AbstractHandlerMethodMapping.java
index d541c01d59..28694baab4 100644
--- a/spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/AbstractHandlerMethodMapping.java
+++ b/spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/AbstractHandlerMethodMapping.java
@@ -260,26 +260,31 @@ public abstract class AbstractHandlerMethodMapping extends AbstractHandlerMap
logger.debug("Looking up handler method for path " + lookupPath);
}
this.mappingRegistry.acquireReadLock();
+
try {
- HandlerMethod handlerMethod = null;
- try {
- handlerMethod = lookupHandlerMethod(lookupPath, exchange);
- }
- catch (Exception ex) {
- return Mono.error(ex);
- }
- if (logger.isDebugEnabled()) {
- if (handlerMethod != null) {
- logger.debug("Returning handler method [" + handlerMethod + "]");
- }
- else {
- logger.debug("Did not find handler method for [" + lookupPath + "]");
- }
- }
- if (handlerMethod != null) {
- handlerMethod = handlerMethod.createWithResolvedBean();
- }
- return Mono.justOrEmpty(handlerMethod);
+ // Ensure form data is parsed for "params" conditions...
+ return exchange.getRequestParams()
+ .then(() -> {
+ HandlerMethod handlerMethod = null;
+ try {
+ handlerMethod = lookupHandlerMethod(lookupPath, exchange);
+ }
+ catch (Exception ex) {
+ return Mono.error(ex);
+ }
+ if (logger.isDebugEnabled()) {
+ if (handlerMethod != null) {
+ logger.debug("Returning handler method [" + handlerMethod + "]");
+ }
+ else {
+ logger.debug("Did not find handler method for [" + lookupPath + "]");
+ }
+ }
+ if (handlerMethod != null) {
+ handlerMethod = handlerMethod.createWithResolvedBean();
+ }
+ return Mono.justOrEmpty(handlerMethod);
+ });
}
finally {
this.mappingRegistry.releaseReadLock();
diff --git a/spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/RequestParamMapMethodArgumentResolver.java b/spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/RequestParamMapMethodArgumentResolver.java
index 979ca7b8f2..a9ae9f8612 100644
--- a/spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/RequestParamMapMethodArgumentResolver.java
+++ b/spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/RequestParamMapMethodArgumentResolver.java
@@ -20,6 +20,8 @@ import java.util.Map;
import java.util.Optional;
import org.springframework.core.MethodParameter;
+import org.springframework.util.Assert;
+import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.RequestParam;
@@ -59,11 +61,17 @@ public class RequestParamMapMethodArgumentResolver implements SyncHandlerMethodA
public Optional