“Starters”的版本间的差异

来自姬鸿昌的知识库
跳到导航 跳到搜索
 
(未显示同一用户的4个中间版本)
第1行: 第1行:
 
https://docs.spring.io/spring-boot/docs/2.7.8/reference/html/using.html#using.build-systems.starters
 
https://docs.spring.io/spring-boot/docs/2.7.8/reference/html/using.html#using.build-systems.starters
 +
 +
所有官方启动器都遵循类似的命名模式; spring-boot-starter-*,其中 * 是特定类型的应用程序。
 
{| class="wikitable"
 
{| class="wikitable"
 
!artifactId
 
!artifactId
第15行: 第17行:
 
</syntaxhighlight>
 
</syntaxhighlight>
 
|spring-boot-starter核心包
 
|spring-boot-starter核心包
 +
包括了自动配置的支持,日志和YAML
 
|-
 
|-
 
|<syntaxhighlight lang="xml">
 
|<syntaxhighlight lang="xml">
第20行: 第23行:
 
<artifactId>spring-boot-starter-web</artifactId>
 
<artifactId>spring-boot-starter-web</artifactId>
 
</syntaxhighlight>
 
</syntaxhighlight>
|web 启动器
+
|web 启动器,用来构建 web,包括 RESTful 和 应用 Spring MVC 的应用程序。
 +
使用 Tomcat 作为默认的内嵌容器
 
|}
 
|}
 +
创建自定义 starter,命名应该是 thirdpartyproject-spring-boot-starter
 +
 +
 +
所有 starter 最底层的依赖:<syntaxhighlight lang="xml">
 +
    <dependency>
 +
      <groupId>org.springframework.boot</groupId>
 +
      <artifactId>spring-boot-starter</artifactId>
 +
      <version>x.x.x.RELEASE</version>
 +
      <scope>compile</scope>
 +
    </dependency>
 +
</syntaxhighlight>

2023年2月1日 (三) 07:30的最新版本

https://docs.spring.io/spring-boot/docs/2.7.8/reference/html/using.html#using.build-systems.starters

所有官方启动器都遵循类似的命名模式; spring-boot-starter-*,其中 * 是特定类型的应用程序。

artifactId 描述
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
spring-boot父pom,继承 spring-boot-dependencies,引入依赖
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
spring-boot-starter核心包

包括了自动配置的支持,日志和YAML

<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
web 启动器,用来构建 web,包括 RESTful 和 应用 Spring MVC 的应用程序。

使用 Tomcat 作为默认的内嵌容器

创建自定义 starter,命名应该是 thirdpartyproject-spring-boot-starter


所有 starter 最底层的依赖:

    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter</artifactId>
      <version>x.x.x.RELEASE</version>
      <scope>compile</scope>
    </dependency>