我的控制器接受参数
public
void changeAvatar(
@ApiParam(value = "A new avatar for the user", required = true)
@RequestPart final MultipartFile avatar,
BindingResult bindingResult
)
向控制器发送请求时,他抛弃了我
java.lang.IllegalStateException: An Errors/BindingResult argument is expected to be declared immediately after the model attribute, the @RequestBody or the @RequestPart arguments to which they apply: public void com.web.web.controller.SettingsRestController.changeAvatar(org.springframework.web.multipart.MultipartFile,org.springframework.validation.BindingResult) throws java.io.IOException
答案 0 :(得分:0)
BindingResult
命令/表单对象数据绑定的验证结果;这个 必须在命令/表单对象之后立即声明参数 控制器方法签名。
因此,您可以使用BindingResult
仅针对 命令/表单对象 获取特定于绑定的分析。