異常描述
啓動項目正常當訪問接口的時頁面拋出了以下異常:
org.springframework.beans.factory.BeanCreationException: 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 [ParallelWebappClassLoader
於是定位到錯誤日誌最開始的地方也就是:
org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:481)
然後我們重啓服務器將斷點加在 ReflectionUtils.java
第481行的位置。
然後我們重啓一下服務器然後當斷點走到這一步時候我們發現了一個異常如下所示:
而這個缺失的類是 Apache Commons FileUpload
組件所以我們導入其相關的依賴就好。
<!-- https://mvnrepository.com/artifact/commons-fileupload/commons-fileupload -->
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<version>1.4</version>
</dependency>
重啓服務器問題解決。