启动报Consider defining a bean of type ‘com.netflix.client.config.IClientConfig‘ in your configuration

启动报Consider defining a bean of type ‘com.netflix.client.config.IClientConfig‘ in your configuration,第1张

启动报Consider defining a bean of type ‘com.netflix.client.config.IClientConfig‘ in your configuration

又是一个日常跳坑,今天的坑还真是没想到,因为报错与原因半毛钱关系没有!!!!

首先,项目是一个springboot+ nacos应用。启动时时失败,控制台打印信息:

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2022-04-25 10:34:34.975 ERROR 12428 --- [           main] o.s.b.d.LoggingFailureAnalysisReporter   : 

***************************
APPLICATION FAILED TO START
***************************

Description:

Parameter 0 of method ribbonServerList in com.alibaba.cloud.nacos.ribbon.NacosRibbonClientConfiguration required a bean of type 'com.netflix.client.config.IClientConfig' that could not be found.


Action:

Consider defining a bean of type 'com.netflix.client.config.IClientConfig' in your configuration.

控制台打印消息提示:考虑在您的配置中定义“com.netflix.client.config.IClientConfig”类型的 bean。 它的意思就是我们少了这个bean ,但是很奇怪,这种类型的bean我并没有用到,而且一般不会改吧。看了网上的方法说既然提示缺少,那就加一个,这样就能启动了,不会报错了,虽然的确能启动,但是这个类型的bean重写后可能会导致别的意料不到的错误。最终我找到错误所在了,在源代码的结构中 我一直都是 src->main->java->com->别的包,但是今天遇到nacos 出错了,我猜测它底层应该是有个扫描代码的方法,错误扫到我们项目中com下发现没有“com.netflix.client.config.IClientConfig”类型的 bean,于是报错,导致我们启动失败。于是我把com改成 cat ,项目就能启动了。这真是坑人的一个bug,光靠提示错误很难找到问题所在。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/langs/738928.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-04-28
下一篇 2022-04-28

发表评论

登录后才能评论

评论列表(0条)

保存