Exclude Part from nested constructor binding in WebFlux

See gh-31778
This commit is contained in:
HeartPattern
2023-12-07 15:59:25 +09:00
committed by rstoyanchev
parent c75c0ae2d5
commit 4d838c1092
2 changed files with 43 additions and 0 deletions

View File

@@ -20,6 +20,8 @@ import java.util.List;
import java.util.Map;
import java.util.TreeMap;
import org.springframework.core.MethodParameter;
import org.springframework.web.multipart.MultipartFile;
import reactor.core.publisher.Mono;
import org.springframework.beans.MutablePropertyValues;
@@ -87,6 +89,13 @@ public class WebExchangeDataBinder extends WebDataBinder {
.then();
}
@Override
protected boolean shouldConstructArgument(MethodParameter param) {
Class<?> type = param.nestedIfOptional().getNestedParameterType();
return (super.shouldConstructArgument(param) &&
!MultipartFile.class.isAssignableFrom(type) && !Part.class.isAssignableFrom(type));
}
/**
* Bind query parameters, form data, or multipart form data to the binder target.
* @param exchange the current exchange