File has already been moved - cannot be transferred again错误

原因是因为前端上传文件大小超过阀值限制

默认大小为 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最大值

你可能感兴趣的:(java)