springboot多项目依赖注入失败问题

项目组成

有一个多模块项目parent,有A,B,C三个模块

A依赖B,B依赖C

C模块

CamundaApi

该类成员注入了IFlowAuthService

package com.parent.A.core;

@Component
public class CamundaApi {
    @Autowired
    private IFlowAuthService flowAuthService;

... ...
}

IFlowAuthService接口

package com.parent.A.service;

public interface IFlowAuthService {
... ...
}

B模块

FlowAuthServiceImpl

C模块中IFlowAuthService的实现类

package com.parent.B.web.service.impl;

@Service
public class FlowAuthServiceImpl implements IFlowAuthService {
... ...
}

A模块

AApplication

启动类

package com.parent;

@SpringBootApplication
@EnableDiscoveryClient
@EnableDubbo
public class AApplication{
    public static void main(String[] args) {
        SpringApplication.run(AApplication.class, args);
    }
}

启动报错

2021-08-16 11:10:53.789 ERROR 8440 --- [           main] o.s.b.d.LoggingFailureAnalysisReporter   :

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

Description:

Field flowAuthService in com.parent.C.core.CamundaApi required a bean of type 'com.parent.C.service.IFlowAuthService' that could not be found.

The injection point has the following annotations:
        - @org.springframework.beans.factory.annotation.Autowired(required=true)


Action:

Consider defining a bean of type 'com.parent.C.service.IFlowAuthService' in your configuration.

描述信息

  1. 如果只有模块BC,B依赖C,启动B可以正常启动
  2. idea中直接运行A模块启动类不报错,只有package之后java -jar xxx.java时会报上边错误
  3. 在注入IFlowAuthServiceAutowired中使用required=false依旧报上边错误
  4. A模块启动类添加@SpringBootApplication(scanBasePackages = {"com.parent"})依旧报上边错误
  5. 在模块CCamundaApi上添加@DependsOn("flowAuthServiceImpl")依旧报上边错误
    @DependsOn("flowAuthServiceImpl")
    public class CamundaApi {
    ... ...
    }
    

请问是不是代码加载的顺序造成的该问题?如果是,是不是在加载C的时候B还未加载
请问该问题该怎么解决,谢谢

启动类上面加上扫描包的注解
@ComponentScan("com.parent")
另外说一下,你的类名书写格式不对,第一个首字母大写,你却首位前两个字母大写,IFlowAuthService,AApplication很明显不对
应该是IflowAuthService Aapplication

启动类上加@ComponentScan("com.parent.B.web.service.impl")

你打包,非启动类所在的模块,都打进去了嘛(jar或者class文件都行)

未复现,请给出你得项目代码