Could not instantiate bean class [org.springframework.web.multipart.MultipartFile]: Specified class

来源:互联网 发布:java await notifyall 编辑:程序博客网 时间:2024/05/22 12:08

解决方案:在Controller的MultipartFile参数前面加上@RequestParam就解决了!


exception

org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.web.multipart.MultipartFile]: Specified class is an interfaceorg.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:656)org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:560)javax.servlet.http.HttpServlet.service(HttpServlet.java:637)javax.servlet.http.HttpServlet.service(HttpServlet.java:717)org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)

root cause

org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.web.multipart.MultipartFile]: Specified class is an interfaceorg.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:101)org.springframework.web.bind.annotation.support.HandlerMethodInvoker.resolveModelAttribute(HandlerMethodInvoker.java:762)org.springframework.web.bind.annotation.support.HandlerMethodInvoker.resolveHandlerArguments(HandlerMethodInvoker.java:356)org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:171)org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:426)org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:414)org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:790)org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:719)org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:644)org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:560)javax.servlet.http.HttpServlet.service(HttpServlet.java:637)javax.servlet.http.HttpServlet.service(HttpServlet.java:717)org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)

note The full stack trace of the root cause is available in the Apache Tomcat/6.0.33 logs.


0 0
原创粉丝点击