Spring file upload - getting Expected MultipartHttpServletRequest: is a MultipartResolver configured? error

前端 未结 3 941
心在旅途
心在旅途 2021-02-03 22:02

I\'m trying to incorporate multiple file upload functionality in my Angular web application using angular-file-upload. Currently, the front end functionality works, but each up

相关标签:
3条回答
  • 2021-02-03 22:42

    Spring's MVC stack requires that the MultipartResolver bean be called multipartResolver. Change your @Bean method to

    @Bean
    public CommonsMultipartResolver multipartResolver(){
    

    or

    @Bean(name = "multipartResolver")
    public CommonsMultipartResolver commonsMultipartResolver(){
    
    0 讨论(0)
  • 2021-02-03 22:45

    You have to add in webmvc-context.xml this:

    <bean class="org.springframework.web.multipart.commons.CommonsMultipartResolver" id="multipartResolver"/>
    
    0 讨论(0)
  • 2021-02-03 22:53

    Just add this to servler-context.xml

    <bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
     <property name="maxUploadSize" value="268435456"/>
    </bean>
    

    Nothing else needed.

    0 讨论(0)
提交回复
热议问题