在Spring Boot中,有一些关于spring-boot-starter
模式的jar。所有这些 jar 不包含任何包。它们有什么用?
在 Maven POM 中,添加了以下依赖项:
- 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 应用程序。
最佳答案
这些依赖项旨在为具有所有需要的依赖项的临时框架项目提供一个统一的入口。
它们通常应该从您的项目描述符 (pom.xml) 继承,以便您获得所有具有配置版本的父依赖项。开发者方面没有更多负担:
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 项目,将包含以下 Artifact (从 spring-boot-starter、spring-boot-starter-web、spring- boot-starter-security 分别):
- Spring Boot Artifact :
- org.springframework.boot:spring-boot
- org.springframework.boot:spring-boot-autoconfigure
- org.springframework.boot:spring-boot-starter-logging
- Spring Core、Web、MVC、安全 Artifact :
- 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 central repository 中无缝导航搜索结果中找到 Artifact 。 .
请注意,这可能不是完整的引用列表,因为某些组件可能会丢失,因此 Artifact 可能会被更新。
关于java - 什么是 `spring-boot-starter` jar ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28273543/