Weird problem when autowired java bean into a Service in a jar

17 views Asked by At

I have a multiple-module Spring Boot 2.5.15 application. Module A contains the SpringApplication, Module B is packaged into a jar file and installed into the local repository, and Module C is still part of the project. Module A depends on B and C, and Module B depends on C. ServiceC is in Module C, and ServiceB is in Module B. When I try to autowire ServiceC into ServiceB and package the whole application into a jar, it works fine. However, when running the SpringApplication in IDEA, an error occurs stating "required a bean of type 'ServiceC' that could not be found." When I put the source of Module B into the project, the problem is solved.

So, I tried creating a similar structure in Spring Boot 3.2.1, and it worked fine. Does anyone have a clue about this issue?

0

There are 0 answers