As I have set maximum file upload limit,I am getting
org.apache.tomcat.util.http.fileupload.FileUploadBase$FileSizeLimitExceededException: The field file exceed
As par I know you can handle the multipart file exception by using this.
@ControllerAdvice
public class MyErrorController extends ResponseEntityExceptionHandler {
Logger logger = org.slf4j.LoggerFactory.getLogger(getClass());
@ExceptionHandler(MultipartException.class)
@ResponseBody
String handleFileException(HttpServletRequest request, Throwable ex) {
//return your json insted this string.
return "File upload error";
}
}