Spring 引导的 Eclipse 外部依赖项 - 为什么它不显示给定项目的 Spring 引导的所有依赖项?

Eclipse external dependencies for Spring Boot - why doesn't it show all dependencies for Spring boot for a given project?

我想弄清楚我们的 spring-boot 项目是否使用了 spring-cloud,它最近发现了一个漏洞。

我知道 spring-boot 附带 spring-cloud 作为依赖项,但是当我在 Eclipse 中检查项目的外部依赖项时,none 其中显示 spring-cloud 作为依赖项。这很好,但为什么呢?

我还看到很多项目使用了一个spring-boot组件,spring-boot-autoconfigure,其中有spring-cloud-spring-service-连接器作为依赖项。这也没有显示为外部依赖性,但同样,为什么呢?看来如果在组件的maven中列为依赖,它应该会自动成为外部依赖。

spring-boot-autoconfigure 主要有 optional 依赖项,这些依赖项永远不会传递和自动包含在使用 spring-boot-autoconfigure 的项目中。 optional dependencies 如何工作在 Maven 文档中进行了解释。

如果你想使用它们,你也需要在你的项目中明确提及它们,这就是为什么如果没有明确提及,你将看不到它们。