稳定的项目还应该使用 spring-boot-starter-* 吗?

Should stable project still use spring-boot-starter-*?

有许多名为 spring-boot-starter-* 的 Maven 工件。顾名思义,它们对于应用程序项目入门非常有用 Spring Boot.

但是应用项目稳定后,是否还要继续使用这些spring-boot-starter-*

我担心的是这样做使用了"transitive dependencies"的Maven机制,似乎违反了Maven documentation中的建议:

Although transitive dependencies can implicitly include desired dependencies, it is a good practice to explicitly specify the dependencies you are directly using in your own source code.

例如,假设一个应用项目直接使用了Spring注解@EventListener。注释在 Maven 工件 spring-context 中,spring-context 包含在 spring-boot-starter 中。应用项目稳定后是否直接指定对spring-context的依赖?

Spring 引导启动器工件只是一个 shorthand,用于一次包含多个 Spring 引导工件。我的公司在生产中提供使用入门工件的服务。当然,您可以用它包含的工件列表替换每个启动器,但我认为 Maven 的建议更多地是关于不相关的传递依赖项,例如如果您的应用程序从某个 JSON 库继承 Guava 作为传递依赖项。

当传递依赖项都来自同一个源并且设计为协同工作时,我认为这不是问题。至少,我不这么认为。