spring-boot-starter Maven 模板

spring-boot-starter Maven 模板

原文: https://howtodoinjava.com/spring-boot2/spring-boot-starter-templates/

不久之前,随着库及其依赖项的数量呈指数级增长,依赖项管理已成为一项非常复杂的任务,需要大量的技术专家才能正确地完成它。 通过引入 String boot 启动器模板,如果您想在项目中使用任何流行的库,则可以在确定要在项目中使用的正确依赖项切面获得大量帮助。

Spring Boot 带有 50 多个不同的启动器模块,这些模块为许多不同的框架提供了现成的集成库,例如关系和 NoSQL 的数据库连接,Web 服务,社交网络集成,监视库,日志记录,模板渲染 ,并且列表一直在继续。

入门模板如何工作?

Spring Boot 启动器是模板,其中包含启动特定功能所需的所有相关传递依赖项的集合。 每个启动器都有一个特殊的文件,其中包含 Spring 提供的所有已提供依赖项的列表。

这些文件可以在相应的启动程序模块的pom.xml文件中找到。 例如

可以在 github 中找到spring-boot-starter-data-jpa入门 pom 文件。

这告诉我们,通过在我们的构建中包含spring-boot-starter-data-jpa作为依赖项,我们将自动获得spring-ormhibernate-entity-managerspring-data-jpa。 这些库将为我们提供开始编写 JPA / DAO 代码的所有基本知识。

因此,下次当您要为项目提供任何特定功能时,我建议您检查现有的入门模板,以查看是否可以直接使用它。 持续不断的社区添加一直在进行,因此此列表已经在增长,您也可以为它做出贡献。

流行的模板及其传递依赖

我列出了一些经常使用的 SpringBoot 器以及它们带来的依赖关系,仅供参考。

启动器 依赖项
spring-boot-starter Sspring-boot, spring-context, spring-beans
spring-boot-starter-jersey jersey-container-servlet-core, jersey-container-servlet, jersey-server
spring-boot-starter-actuator spring-boot-actuator, micrometer-core
spring-boot-starter-aop spring-aop, aspectjrt, aspectjweaver
spring-boot-starter-data-rest spring-hateoas, spring-data-rest-webmvc
spring-boot-starter-hateoas spring-hateoas
spring-boot-starter-logging logback-classic, jcl-over-slf4j, jul-to-slf4j
spring-boot-starter-log4j2 log4j2, log4j-slf4j-impl
spring-boot-starter-security spring-security-web, spring-security-config
spring-boot-starter-test spring-test, spring-boot,junit,mockito, hamcrest-library, assertj, jsonassert, json-path
spring-boot-starter-web-services spring-ws-core

将我的问题放在评论部分。

学习愉快!

参考文献:

SpringBoot 启动器

使用启动启动器