A component required a bean of type ‘XXX‘ that could not be found 解决办法
程序员文章站
2022-06-24 20:34:15
...
springboot应用启动的时候,bean的加载扫描失败,错误信息如下A component required a bean of type 'XXX' that could not be found.
***************************
APPLICATION FAILED TO START
***************************
Description:
A component required a bean of type 'com.littlefox.cloud.api.sequence.remote.RemoteSequenceService' that could not be found.
Action:
Consider defining a bean of type 'com.littlefox.cloud.api.sequence.remote.RemoteSequenceService' in your configuration.
场景是这样的,我依赖了我另外一个服务用来生成主键ID,但是这两个项目包结构不一样 com.littlefox.generic.GenericApplication
解决办法
将GenericApplication
类移动到com.littlefox
下,保证与另外的服务同级,因为是自上而下扫描加载,所以你只需要将启动类移动到包结构目录开始不一样的层级即可,在我这里最后为 com.littlefox.GenerricApplication
就可以顺利启动了
下一篇: Linux 使用系统调用进行文件读写
推荐阅读
-
多模块项目依赖注入失败Field xxRepository in xxImpl required a bean of type xxRepository that could not be found
-
A component required a bean of type ‘XXX‘ that could not be found 解决办法
-
解决 A component required a bean of 'XXX.RoleService' that could not be found.
-
解决报错 :A component required a bean of type 'gentle.test.Show' that could not be found
-
解决:A component required a bean of type 'javax.jms.Queue' that could not be found.
-
多模块项目依赖注入失败Field xxRepository in xxImpl required a bean of type xxRepository that could not be found