1、SpringMVC上传文件,SpringMVC.xml配置
2、在启动项目,加载springmvc.xml文件时中报异常
Error creating bean with name 'multipartResolver': Lookup method resolution failed; nested exception is java.lang.IllegalStateException: Failed to introspect Class [org.springframework.web.multipart.commons.CommonsMultipartResolver] from ClassLoader [WebappClassLoader
context: silence_xml_ssm
delegate: false
----------> Parent Classloader:
java.net.URLClassLoader@156643d4
]
12-Sep-2019 17:24:09.722 信息 [RMI TCP Connection(3)-127.0.0.1] com.alibaba.druid.support.logging.JakartaCommonsLoggingImpl.info {dataSource-2} closed
12-Sep-2019 17:24:09.722 严重 [RMI TCP Connection(3)-127.0.0.1] org.springframework.web.servlet.FrameworkServlet.initServletBean Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'multipartResolver': Lookup method resolution failed; nested exception is java.lang
原因是:没有commons-fileupload包导致的,然后就在pom里加入了依赖便可解决问题。
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<version>1.3.1</version>
</dependency>