異常詳情
Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name xxxxx
Lookup method resolution failed; nested exception is java.lang.IllegalStateException: Failed to introspect Class [classA] from ClassLoader [sun.misc.Launcher$AppClassLoader@14dad5dc]
原因
此異常原因是因為classA中使用了項目沒有導入的類,從而導致類加載失敗。一般來說如果使用了沒有依賴的類應該會報ClassNotFindException的錯誤
通常此錯誤見與使用maven框架配置了第三方類的scope是provided的情況下。
注意: 啟動的子模塊中一定要引入該jar包
(有時候項目中依賴了該jar包, 但是在啟動模塊中排除或者其他原因導致沒有引入)
解決辦法
檢查classA類中可能存在的沒有依賴的類或者包,將之導入(或者加入maven依賴、或調整依賴的包中的依賴的scope),總之使其類加載器能夠在當期classPath找到此類即可。
原文地址:
https://blog.csdn.net/huitoukest/article/details/88013763
https://blog.csdn.net/huitoukest/article/details/88013763