Fix BindingResult error when ModelAttribute has custom name in WebFlux

Closes gh-28422
This commit is contained in:
Carlos Bouzón García
2022-05-06 00:00:02 +02:00
committed by Sam Brannen
parent f771603789
commit 39e3876301
2 changed files with 40 additions and 1 deletions

View File

@@ -86,7 +86,7 @@ public class ErrorsMethodArgumentResolver extends HandlerMethodArgumentResolverS
"Either declare the @ModelAttribute without an async wrapper type or " +
"handle a WebExchangeBindException error signal through the async type.");
ModelAttribute ann = parameter.getParameterAnnotation(ModelAttribute.class);
ModelAttribute ann = attributeParam.getParameterAnnotation(ModelAttribute.class);
String name = (ann != null && StringUtils.hasText(ann.value()) ?
ann.value() : Conventions.getVariableNameForParameter(attributeParam));
Object errors = context.getModel().asMap().get(BindingResult.MODEL_KEY_PREFIX + name);