gpt4 book ai didi

Spring 初始化 : spring-boot-starter vs spring-boot-starter-web

转载 作者:行者123 更新时间:2023-12-03 15:22:58 35 4
gpt4 key购买 nike

我正在尝试在 IntellIJ 中开发一个基于 Spring Boot 的示例应用程序。所以我使用了 spring Initialzr 方法,并在设置过程中进行了默认选择。我最终得到的 pom.xml 具有以下依赖性:

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>

但是我正在关注的教程如下:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>

那么,有什么区别呢?我可以两者兼得吗?

最佳答案

spring-boot-starter-web 包含以下依赖项:

  • spring-boot-starter
  • jackson
  • Spring 芯
  • spring-mvc
  • spring-boot-starter-tomcat

  • 使用 IntelliJ,您可以在项目结构的底部查看工件的依赖关系。

    鉴于 spring-boot-starter 是 spring-boot-starter-web 的一个依赖项,两者兼而有之是没有用的。如果你同时保留两者都不会造成任何伤害,只是没有必要。

    关于 Spring 初始化 : spring-boot-starter vs spring-boot-starter-web,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54453745/

    35 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com