Add reflection hints for data binding in Web controllers

Closes gh-28623
This commit is contained in:
Sébastien Deleuze
2022-07-11 11:37:41 +02:00
parent 4104ea7c1c
commit 9d42779826
2 changed files with 24 additions and 1 deletions

View File

@@ -72,7 +72,8 @@ class RequestMappingReflectiveProcessor implements ReflectiveProcessor {
hints.registerMethod(method, hint -> hint.setModes(ExecutableMode.INVOKE));
for (Parameter parameter : method.getParameters()) {
MethodParameter methodParameter = MethodParameter.forParameter(parameter);
if (methodParameter.hasParameterAnnotation(RequestBody.class)) {
if (methodParameter.hasParameterAnnotation(RequestBody.class) ||
methodParameter.hasParameterAnnotation(ModelAttribute.class)) {
this.bindingRegistrar.registerReflectionHints(hints, methodParameter.getGenericParameterType());
}
else if (HttpEntity.class.isAssignableFrom(methodParameter.getParameterType())) {