什么是 `spring-boot-starter` 罐子?
What are `spring-boot-starter` jars?
在Spring引导中,spring-boot-starter
的模式下有一些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 引导 jar 才能使用这些 jar 中的功能?我的项目没有任何依赖管理。我的项目是一个 Spring MVC 应用程序,它使用 Spring 安全性。
这些依赖项旨在为具有所有所需依赖项.
的临时骨架项目提供统一入口
它们通常应该从您的项目描述符 (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.
编辑:
这些 POM 可用于合成可用于某种项目的依赖项,例如对于一个简单的 Spring MVC 项目,将包含以下工件(阅读自 spring-boot-starter、spring-boot-starter-web、spring-boot-starter-security):
- Spring 引导工件:
- org.springframework.boot:spring-boot
- org.springframework.boot:spring-boot-autoconfigure
- org.springframework.boot:spring-boot-starter-logging
- Spring 核心、Web、MVC、安全工件:
- org.springframework:spring-核心
- org.springframework:spring-web
- org.springframework:spring-webmvc
- org.springframework:spring-豆子
- org.springframework:spring-上下文
- org.springframework:spring-表达式
- org.springframework:spring-aop
- org.springframework.security:spring-security-config
- org.springframework.security:spring-security-web
- org.hibernate:休眠验证器
- com.fasterxml.jackson.core:jackson-databind
可以在 maven central repository 中无缝导航搜索结果找到工件。
请注意,这可能不是完整的参考列表,因为某些组件可能缺失,因此工件可能会更新。
简单地说,它们是依赖项描述符,列出了经过测试可以协同工作的版本的传递依赖项,以节省您尝试将处理应用程序某些方面的库放在一起的时间。
你也可以让maven报告在spring启动项目pom.xml文件中定义的各种spring-boot-starter-*需要的依赖,使用下面的命令
mvn dependency:resolve
例如 spring 1.5.8.RELEASE,使用以下 jar(和版本)
备注格式为群组Id:ArtifactId:Version:Scope
The following files have been resolved:
com.fasterxml.jackson.core:jackson-annotations:jar:2.8.0:compile
org.jboss.logging:jboss-logging:jar:3.3.1.Final:compile
aopalliance:aopalliance:jar:1.0:compile
org.hamcrest:hamcrest-library:jar:1.3:test
org.mockito:mockito-core:jar:1.10.19:test
org.assertj:assertj-core:jar:2.6.0:test
org.springframework:spring-beans:jar:4.3.12.RELEASE:compile
org.springframework.boot:spring-boot-test:jar:1.5.8.RELEASE:test
org.springframework.boot:spring-boot-autoconfigure:jar:1.5.8.RELEASE:compile
org.springframework.boot:spring-boot-starter-tomcat:jar:1.5.8.RELEASE:compile
org.skyscreamer:jsonassert:jar:1.4.0:test
org.yaml:snakeyaml:jar:1.17:runtime
com.fasterxml:classmate:jar:1.3.4:compile
org.slf4j:jcl-over-slf4j:jar:1.7.25:compile
org.springframework.boot:spring-boot-starter-test:jar:1.5.8.RELEASE:test
org.hamcrest:hamcrest-core:jar:1.3:test
com.jayway.jsonpath:json-path:jar:2.2.0:test
org.apache.tomcat.embed:tomcat-embed-websocket:jar:8.5.23:compile
org.springframework.boot:spring-boot:jar:1.5.8.RELEASE:compile
org.apache.tomcat:tomcat-annotations-api:jar:8.5.23:compile
org.springframework:spring-context:jar:4.3.12.RELEASE:compile
org.hibernate:hibernate-validator:jar:5.3.5.Final:compile
javax.validation:validation-api:jar:1.1.0.Final:compile
org.apache.tomcat.embed:tomcat-embed-core:jar:8.5.23:compile
org.springframework.boot:spring-boot-starter-logging:jar:1.5.8.RELEASE:compile
com.fasterxml.jackson.core:jackson-core:jar:2.8.10:compile
org.ow2.asm:asm:jar:5.0.3:test
org.apache.tomcat.embed:tomcat-embed-el:jar:8.5.23:compile
org.slf4j:log4j-over-slf4j:jar:1.7.25:compile
org.springframework:spring-web:jar:4.3.12.RELEASE:compile
ch.qos.logback:logback-core:jar:1.1.11:compile
org.springframework.security:spring-security-core:jar:4.2.3.RELEASE:compile
org.springframework:spring-test:jar:4.3.12.RELEASE:test
org.springframework.boot:spring-boot-starter:jar:1.5.8.RELEASE:compile
org.springframework.security:spring-security-test:jar:4.2.3.RELEASE:test
org.springframework.boot:spring-boot-starter-web:jar:1.5.8.RELEASE:compile
org.springframework:spring-core:jar:4.3.12.RELEASE:compile
org.springframework.boot:spring-boot-starter-security:jar:1.5.8.RELEASE:compile
org.springframework.boot:spring-boot-actuator:jar:1.5.8.RELEASE:compile
org.objenesis:objenesis:jar:2.1:test
org.springframework:spring-expression:jar:4.3.12.RELEASE:compile
org.springframework.boot:spring-boot-starter-actuator:jar:1.5.8.RELEASE:compile
org.springframework.security:spring-security-config:jar:4.2.3.RELEASE:compile
org.springframework.security:spring-security-web:jar:4.2.3.RELEASE:compile
org.springframework:spring-aop:jar:4.3.12.RELEASE:compile
junit:junit:jar:4.12:test
org.slf4j:slf4j-api:jar:1.7.25:compile
net.minidev:json-smart:jar:2.2.1:test
org.springframework.boot:spring-boot-test-autoconfigure:jar:1.5.8.RELEASE:test
net.minidev:accessors-smart:jar:1.1:test
org.springframework:spring-webmvc:jar:4.3.12.RELEASE:compile
ch.qos.logback:logback-classic:jar:1.1.11:compile
org.slf4j:jul-to-slf4j:jar:1.7.25:compile
com.fasterxml.jackson.core:jackson-databind:jar:2.8.10:compile
只需忽略具有部署测试范围的 jar。
如果您手边没有 spring 引导项目,只需在 Spring Initializr, with whatever spring boot starters you need. It also uses maven wrapper 创建一个,它包含 maven 命令,从而节省您单独设置和安装 maven 的时间。
所以只需从Spring Initializr 下载zip 文件,解压并在解压后的文件夹中打开命令提示符,然后使用以下命令代替
对于Linux/MacOS
./mvnw dependency:resolve
对于windows
./mvnw.cmd dependency:resolve
在Spring引导中,spring-boot-starter
的模式下有一些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 引导 jar 才能使用这些 jar 中的功能?我的项目没有任何依赖管理。我的项目是一个 Spring MVC 应用程序,它使用 Spring 安全性。
这些依赖项旨在为具有所有所需依赖项.
的临时骨架项目提供统一入口它们通常应该从您的项目描述符 (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.
编辑:
这些 POM 可用于合成可用于某种项目的依赖项,例如对于一个简单的 Spring MVC 项目,将包含以下工件(阅读自 spring-boot-starter、spring-boot-starter-web、spring-boot-starter-security):
- Spring 引导工件:
- org.springframework.boot:spring-boot
- org.springframework.boot:spring-boot-autoconfigure
- org.springframework.boot:spring-boot-starter-logging
- Spring 核心、Web、MVC、安全工件:
- org.springframework:spring-核心
- org.springframework:spring-web
- org.springframework:spring-webmvc
- org.springframework:spring-豆子
- org.springframework:spring-上下文
- org.springframework:spring-表达式
- org.springframework:spring-aop
- org.springframework.security:spring-security-config
- org.springframework.security:spring-security-web
- org.hibernate:休眠验证器
- com.fasterxml.jackson.core:jackson-databind
可以在 maven central repository 中无缝导航搜索结果找到工件。
请注意,这可能不是完整的参考列表,因为某些组件可能缺失,因此工件可能会更新。
简单地说,它们是依赖项描述符,列出了经过测试可以协同工作的版本的传递依赖项,以节省您尝试将处理应用程序某些方面的库放在一起的时间。
你也可以让maven报告在spring启动项目pom.xml文件中定义的各种spring-boot-starter-*需要的依赖,使用下面的命令
mvn dependency:resolve
例如 spring 1.5.8.RELEASE,使用以下 jar(和版本)
备注格式为群组Id:ArtifactId:Version:Scope
The following files have been resolved:
com.fasterxml.jackson.core:jackson-annotations:jar:2.8.0:compile
org.jboss.logging:jboss-logging:jar:3.3.1.Final:compile
aopalliance:aopalliance:jar:1.0:compile
org.hamcrest:hamcrest-library:jar:1.3:test
org.mockito:mockito-core:jar:1.10.19:test
org.assertj:assertj-core:jar:2.6.0:test
org.springframework:spring-beans:jar:4.3.12.RELEASE:compile
org.springframework.boot:spring-boot-test:jar:1.5.8.RELEASE:test
org.springframework.boot:spring-boot-autoconfigure:jar:1.5.8.RELEASE:compile
org.springframework.boot:spring-boot-starter-tomcat:jar:1.5.8.RELEASE:compile
org.skyscreamer:jsonassert:jar:1.4.0:test
org.yaml:snakeyaml:jar:1.17:runtime
com.fasterxml:classmate:jar:1.3.4:compile
org.slf4j:jcl-over-slf4j:jar:1.7.25:compile
org.springframework.boot:spring-boot-starter-test:jar:1.5.8.RELEASE:test
org.hamcrest:hamcrest-core:jar:1.3:test
com.jayway.jsonpath:json-path:jar:2.2.0:test
org.apache.tomcat.embed:tomcat-embed-websocket:jar:8.5.23:compile
org.springframework.boot:spring-boot:jar:1.5.8.RELEASE:compile
org.apache.tomcat:tomcat-annotations-api:jar:8.5.23:compile
org.springframework:spring-context:jar:4.3.12.RELEASE:compile
org.hibernate:hibernate-validator:jar:5.3.5.Final:compile
javax.validation:validation-api:jar:1.1.0.Final:compile
org.apache.tomcat.embed:tomcat-embed-core:jar:8.5.23:compile
org.springframework.boot:spring-boot-starter-logging:jar:1.5.8.RELEASE:compile
com.fasterxml.jackson.core:jackson-core:jar:2.8.10:compile
org.ow2.asm:asm:jar:5.0.3:test
org.apache.tomcat.embed:tomcat-embed-el:jar:8.5.23:compile
org.slf4j:log4j-over-slf4j:jar:1.7.25:compile
org.springframework:spring-web:jar:4.3.12.RELEASE:compile
ch.qos.logback:logback-core:jar:1.1.11:compile
org.springframework.security:spring-security-core:jar:4.2.3.RELEASE:compile
org.springframework:spring-test:jar:4.3.12.RELEASE:test
org.springframework.boot:spring-boot-starter:jar:1.5.8.RELEASE:compile
org.springframework.security:spring-security-test:jar:4.2.3.RELEASE:test
org.springframework.boot:spring-boot-starter-web:jar:1.5.8.RELEASE:compile
org.springframework:spring-core:jar:4.3.12.RELEASE:compile
org.springframework.boot:spring-boot-starter-security:jar:1.5.8.RELEASE:compile
org.springframework.boot:spring-boot-actuator:jar:1.5.8.RELEASE:compile
org.objenesis:objenesis:jar:2.1:test
org.springframework:spring-expression:jar:4.3.12.RELEASE:compile
org.springframework.boot:spring-boot-starter-actuator:jar:1.5.8.RELEASE:compile
org.springframework.security:spring-security-config:jar:4.2.3.RELEASE:compile
org.springframework.security:spring-security-web:jar:4.2.3.RELEASE:compile
org.springframework:spring-aop:jar:4.3.12.RELEASE:compile
junit:junit:jar:4.12:test
org.slf4j:slf4j-api:jar:1.7.25:compile
net.minidev:json-smart:jar:2.2.1:test
org.springframework.boot:spring-boot-test-autoconfigure:jar:1.5.8.RELEASE:test
net.minidev:accessors-smart:jar:1.1:test
org.springframework:spring-webmvc:jar:4.3.12.RELEASE:compile
ch.qos.logback:logback-classic:jar:1.1.11:compile
org.slf4j:jul-to-slf4j:jar:1.7.25:compile
com.fasterxml.jackson.core:jackson-databind:jar:2.8.10:compile
只需忽略具有部署测试范围的 jar。
如果您手边没有 spring 引导项目,只需在 Spring Initializr, with whatever spring boot starters you need. It also uses maven wrapper 创建一个,它包含 maven 命令,从而节省您单独设置和安装 maven 的时间。
所以只需从Spring Initializr 下载zip 文件,解压并在解压后的文件夹中打开命令提示符,然后使用以下命令代替
对于Linux/MacOS
./mvnw dependency:resolve
对于windows
./mvnw.cmd dependency:resolve