SpringBoot's @MultipartConfig maxFileSize not taking effect

后端 未结 7 1510
野性不改
野性不改 2021-02-02 07:52

I have a controller with a MultipartConfig annotation (a snippet of which is show below):

@RestController
@RequestMapping(\"packages\")
@MultipartCo         


        
相关标签:
7条回答
  • 2021-02-02 08:45

    Application property is one option. Another option is

    @Bean
    public MultipartConfigElement multipartConfigElement() {
      MultipartConfigFactory factory = new MultipartConfigFactory();
      factory.setMaxFileSize("10MB");
      factory.setMaxRequestSize("10MB");
      return factory.createMultipartConfig();
    }
    
    0 讨论(0)
提交回复
热议问题