springboot附件上传超限org.apache.tomcat.util.http.fileupload.FileUploadBase$FileSizeLimitExceededException

1.项目使用的是Spring Boot ,上传附件报超出自带tomacat限制大小(默认1M)

org.apache.tomcat.util.http.fileupload.FileUploadBase$FileSizeLimitExceededException: The field file exceeds its maximum permitted size of xxx bytes.

2.解决方案

  /**
     * 文件上传配置
     * 
     * @return
     */
    @Bean
    public MultipartConfigElement multipartConfigElement() {
        MultipartConfigFactory factory = new MultipartConfigFactory();
        //  单个数据大小
        factory.setMaxFileSize("10240KB"); // KB,MB
        /// 总上传数据大小
        factory.setMaxRequestSize("102400KB");
        return factory.createMultipartConfig();
    }

你可能感兴趣的:(springboot附件上传超限org.apache.tomcat.util.http.fileupload.FileUploadBase$FileSizeLimitExceededException)