-
Notifications
You must be signed in to change notification settings - Fork 685
Avoid matching multipart parameters annotated with @ModelAttribute #3277
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,11 +36,13 @@ | |
import org.springframework.web.context.request.NativeWebRequest; | ||
import org.springframework.web.method.annotation.ModelAttributeMethodProcessor; | ||
import org.springframework.web.method.support.HandlerMethodArgumentResolver; | ||
import org.springframework.web.multipart.support.MultipartResolutionDelegate; | ||
|
||
/** | ||
* {@link HandlerMethodArgumentResolver} to create Proxy instances for interface based controller method parameters. | ||
* | ||
* @author Oliver Gierke | ||
* @author Chris Bono | ||
* @since 1.10 | ||
*/ | ||
public class ProxyingHandlerMethodArgumentResolver extends ModelAttributeMethodProcessor | ||
|
@@ -88,9 +90,9 @@ public boolean supportsParameter(MethodParameter parameter) { | |
return false; | ||
} | ||
|
||
// Annotated parameter | ||
if (parameter.getParameterAnnotation(ProjectedPayload.class) != null | ||
|| parameter.getParameterAnnotation(ModelAttribute.class) != null) { | ||
// Annotated parameter (excluding multipart) | ||
if ((parameter.hasParameterAnnotation(ProjectedPayload.class) || parameter.hasParameterAnnotation( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Long-term (in 4.0) we will further investigate why this resolver does not support multipart file parameters. Until then, now that we allow |
||
ModelAttribute.class)) && !MultipartResolutionDelegate.isMultipartArgument(parameter)) { | ||
return true; | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The only place I see this documented is in
spring-data-commons/src/main/antora/modules/ROOT/pages/repositories/core-extensions.adoc
and was not sure if we wanted to add this ability in there as it is pretty high-level. Wdyt?