-
Notifications
You must be signed in to change notification settings - Fork 38.3k
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
DataBinder fails with "No primary or single unique constructor found for interface MultipartFile" #31669
Comments
I am not sure about that. Can you check that you compile your code with |
@rstoyanchev is the new check in DataBinder possibly mis-handling |
@mschneid apologizes, we've got many report around this and I thought it could have been one more occurrence. |
@mschneid, thanks for the sample. |
The following example works with Spring Framework 6.0, but not with 6.1:
The above code throws the exception
java.lang.IllegalStateException: No primary or single unique constructor found for interface org.springframework.web.multipart.MultipartFile
if the file is not specified in the request.The method
DataBinder#shouldCreateObject(MethodParameter)
was introduced with #31488. I think this method should also check whether the parameter is optional or not by callingMethodParameter#isOptional()
.The text was updated successfully, but these errors were encountered: