美文网首页
SpringBoot上传文件异常-Required reques

SpringBoot上传文件异常-Required reques

作者: Dream笔 | 来源:发表于2018-05-22 14:03 被阅读0次
org.springframework.web.multipart.support.MissingServletRequestPartException: Required request part 'file' is not present
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:707) [13 skipped]
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) [1 skipped]
    at org.springframework.boot.web.filter.ApplicationContextHeaderFilter.doFilterInternal(ApplicationContextHeaderFilter.java:55) [2 skipped]
    at org.springframework.boot.actuate.trace.WebRequestTraceFilter.doFilterInternal(WebRequestTraceFilter.java:110) [3 skipped]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [44 skipped]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)

异常原因

指定了上传文件的处理器

    @Bean
    public MultipartResolver multipartResolver() {
        return new CommonsMultipartResolver();
    }

解决办法

注释掉,不指定文件处理器

相关文章

网友评论

      本文标题:SpringBoot上传文件异常-Required reques

      本文链接:https://www.haomeiwen.com/subject/aqbhjftx.html