起因是因为前端上传文件大小超过阀值限度
默认大小为 10KB
批改办法:
@Configuration
public class MultipartResolverConfig {
@Bean
public CommonsMultipartResolver multipartResolver(){CommonsMultipartResolver resolver = new CommonsMultipartResolver();
resolver.setDefaultEncoding("UTF-8");
resolver.setMaxInMemorySize(Integer.MAX_VALUE);
return resolver;
}
}
将 maxInMemorySize 属性适当减少,最大值为 int 最大值