在A項目中定義類了一些bean,並用Spring的@Component註解標識了。
在B項目中引用了A項目,即在pom.xml的dependency中添加了項目A。
在SpringBoot啓動的時候報找不到A項目中的bean。
因爲SpringBoot的啓動Application的默認的ComponentScan的範圍中沒有包含A項目的bean所在的package路徑。
在B項目中增加@ComponentScan(“com.package.where.projectA.class.is”)。