Bootstrap

springboot xxxServiceImpl 无法 跨module 注入 xxxDao问题

错误描述:

Description:

Field xxxDao in com.abc.web.service.impl.PostServiceImpl required a bean of type 'com.abc.core.dao.PostDao' that could not be found.


Action:

Consider defining a bean of type 'com.abc.core.dao.PostDao' in your configuration.

问题描述:

xxxDao、xxxDaoImpl在module(abc-core)

xxxService、xxxServiceImpl在module(abc-web)

 

解决方法

  1. @ComponentScan("com.abc")

  2. ​​​​​​@ComponentScan(basePackages = {"com.abc.core", "com.abc.web"})

  3. @SpringBootApplication(scanBasePackages = "com.abc")

三种方法都无效,求老司机解答?跪谢。。。

 

附other弃坑大法:

关于spring boot自动注入出现Consider defining a bean of type 'xxx' in your configuration问题解决方案

SpringBoot 多模块项目(module)Service自动注入(@Autowired)

Spring Boot @Autowired 没法自动注入的问题

IDEA搭建Spring boot问题集

多模块配置

https://blog.csdn.net/sinat_36304803/article/details/81512589

;