什么是“spring-boot-starter"罐子? [英] What are `spring-boot-starter` jars?

查看:31
本文介绍了什么是“spring-boot-starter"罐子?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Spring Boot中,有一些关于spring-boot-starter模式的jar包.所有这些 jars 都不包含任何包.它们有什么用?

In Spring Boot, there are some jars on the pattern of spring-boot-starter. All these jars do not contain any packages. What is their use?

在 Maven POM 中,添加了以下依赖项:

In Maven POMs, the following dependencies are added:

  • org.springframework.boot:spring-boot-starter-web
  • org.springframework.boot:spring-boot-starter-actuator
  • org.springframework.boot:spring-boot-starter-security

我实际上需要使用哪些 Spring Boot jar 来使用这些 jar 中的功能?我的项目没有任何依赖管理.我的项目是一个使用 Spring Security 的 Spring MVC 应用程序.

Which Spring Boot jars do I actually need to use the functionality in these jars? My project does not have any dependency management. My project is a Spring MVC application which uses Spring Security.

推荐答案

这些依赖项旨在为具有所有所需依赖项的临时骨架项目提供统一入口.

Those dependencies are meant to provide a unified entry to an ad-hoc skeleton project with all needed dependencies.

它们通常应该从您的项目描述符 (pom.xml) 继承,以便您获得具有配置版本的所有父依赖项.开发者方面没有更多的负担:

They should usually be inherited from your project descriptor (pom.xml) so that you get all parent dependecies with configured versions. No more burden to be done on the developer side:

Starter POM 是一组方便的依赖项描述符,您可以将其包含在您的应用程序中.您可以获得所需的所有 Spring 和相关技术的一站式服务,而无需搜索示例代码和复制粘贴加载的依赖项描述符.例如,如果您想开始使用 Spring 和 JPA 进行数据库访问,只需在您的项目中包含 spring-boot-starter-data-jpa 依赖项,就可以了.

Starter POMs are a set of convenient dependency descriptors that you can include in your application. You get a one-stop-shop for all the Spring and related technology that you need, without having to hunt through sample code and copy paste loads of dependency descriptors. For example, if you want to get started using Spring and JPA for database access, just include the spring-boot-starter-data-jpa dependency in your project, and you are good to go.

参考,Spring Boot Starter POM.

那些 POM 可用于合成可用于某种项目的依赖项,例如对于一个简单的 Spring MVC 项目,将包含以下工件(从 spring-boot-starterspring-boot-starter-webspring-boot-starter-security 分别):

Those POMs can be used to synthesize the dependencies that can be used for a certain kind of project, e.g. for a simple Spring MVC project, the following artifacts are to be included (Read from spring-boot-starter, spring-boot-starter-web, spring-boot-starter-security respectively):

  • Spring Boot 工件:
    • org.springframework.boot:spring-boot
    • org.springframework.boot:spring-boot-autoconfigure
    • org.springframework.boot:spring-boot-starter-logging
    • org.springframework:spring-core
    • org.springframework:spring-web
    • org.springframework:spring-webmvc
    • org.springframework:spring-beans
    • org.springframework:spring-context
    • org.springframework:spring-expression
    • org.springframework:spring-aop
    • org.springframework.security:spring-security-config
    • org.springframework.security:spring-security-web
    • org.hibernate:hibernate-validator
    • com.fasterxml.jackson.core:jackson-databind

    可以在 maven 中央存储库中无缝导航搜索结果找到工件.

    The artifacts can be found seamlessly navigating search results in the maven central repository.

    请注意,这可能不是完整的参考列表,因为某些组件可能会丢失,因此工件可能会更新.

    这篇关于什么是“spring-boot-starter"罐子?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆