使用 intellijIDEA 的 Spring Beans 依赖关系图中缺少连接

问题描述 投票:0回答:0

我正在开发一个包含 3 个类的简单 Spring 应用程序:

  • 产品服务
  • 产品回购
  • 产品配置

为了理解,我尝试展示 Beans Dependencies 的图表

对于特定的 Bean **ProductService **

这里是三个类的代码

产品服务

@Service
@AllArgsConstructor
public class ProductService { 
    private final ProductRepo productRepo;
}

产品回购

@AllArgsConstructor
@Repository
public class ProductRepo {

    private final JdbcTemplate jdbcTemplate;
}

产品配置

@Configuration
@ComponentScan("com")
public class ProductConfig{

    @Bean
    public DataSource dataSource()
    {
        return new DriverManagerDataSource(
                "jdbc:mysql://localhost:3306/productnew",
                "root",
                "root");
    }
    @Bean
    public JdbcTemplate jdbcTemplate(){
        return new JdbcTemplate(dataSource());
    }
}

然而,productService 注入了 ProductRepo 的依赖项,我没有找到此通信(对于 productService bean,我只是找到 productService 和 productConfig 之间的关联),如图所示。

Spring Beans Dependencies Diagram ---ZOOM on productService Bean

我尝试刷新IntellijIDEA并删除所有项目的缓存和索引,但问题仍然存在

spring-boot intellij-idea dependency-injection diagram spring-bean
© www.soinside.com 2019 - 2024. All rights reserved.