Method not loaded because @ConditionalOnClass

SpringBoot项目中经常会碰到类似的报错,Parameter 0 of constructor in *** required a bean of type *** that could not be found.    - Bean method *** not loaded because @ConditionalOnClass *** did not find class,大致的意思就是找不到某个类,但是按照所给路径去找的话却能找到,而且环境配置也没有问题,网上查过很多资料,始终没能解决。

错误提示:
Parameter 0 of constructor in *** required a bean of type *** that could not be found. - Bean method *** not loaded because @ConditionalOnClass *** did not find class。
问题分析:
相应的jar包出了问题,maven默认下载jar的地方是官网,为国外网站,而且很多jar并不在官方服务器上面,需要转连到其他服务器上,而每次下载jar由于网速不稳定,很容易丢失或损坏jar包,导致虽然看起来文件库中有这个jar包,但其实并没有下载全,其中包含的类也是一样。
解决方法:
删除掉提示问题的类所在的jar包或文件夹,然后Update Project,重新下载jar包。
备注:
Maven项目中出现的问题,大多都是jar包问题,因此遇到错误提示时,首先考虑jar包配置或者下载问题。

猜你喜欢

转载自blog.51cto.com/13402621/2152990
今日推荐