SpringCloud之服务注入调用报错Consider defining a bean of type 'xxx' in your configuration,could not be found
微服务跨父子(module)项目调用service、@Autowire报错Description:Field IndexService in com.luda.springcloud.MainController required a bean of type 'com.luda.springcloud.IndexService' that could not be found.Actio...
·
微服务跨父子(module)项目调用service、@Autowire报错
Description:Field IndexService in com.luda.springcloud.MainController required a bean of type 'com.luda.springcloud.IndexService' that could not be found.
Action:Consider defining a bean of type 'com.luda.springcloud.IndexService' in your configuration.
网上找了很多:说是application目录的问题。但那只针对同一项目的调用。
当跨项目时,应该在application文件里面修改注解
@SpringBootApplication(scanBasePackages = "com.luda"),以扫描指定com.luda包下所有的类,并纳入spring容器中,重新启动项目。
更多推荐
已为社区贡献4条内容
所有评论(0)