Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/spring-boot/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
spring初始化器:spring boot starter与spring boot starter web_Spring_Spring Boot_Intellij Idea - Fatal编程技术网

spring初始化器:spring boot starter与spring boot starter web

spring初始化器:spring boot starter与spring boot starter web,spring,spring-boot,intellij-idea,Spring,Spring Boot,Intellij Idea,我正在尝试用IntellIJ开发一个基于spring引导的示例应用程序。所以我使用了SpringInitialZR方法,并在设置过程中进行了默认选择。我最终得到的pom.xml具有以下依赖性: <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter</artifactId> </

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

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

org.springframework.boot
弹簧靴起动器
但我下面的教程有以下内容:

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

org.springframework.boot
SpringBootStarterWeb

那么,有什么区别呢?我可以两者都要吗?

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

  • 弹簧靴起动器
  • 杰克逊
  • 弹簧芯
  • 春季mvc
  • 弹簧启动机tomcat
使用IntelliJ,您可以在项目结构的底部查看工件的依赖关系


考虑到SpringBootStarter是SpringBootStarterWeb的一个依赖项,所以两者兼有是没有用的。如果你把两者都留下也不会有什么坏处,只是没必要

spring boot starter为您的应用程序提供了基本的开发和运行时基础设施以及spring的核心功能。如果您希望在项目中使用SpringMVC等web功能,则需要使用SpringBootStarterWeb。但是,如果您使用spring boot starter web,则无需明确提及spring boot starter。

spring boot starter本身就是spring boot starter web的一个依赖项。如果您只在应用程序中包含SpringBootStarter依赖项,那么您将只获得运行时基础设施以及一些核心功能。因此,对于web应用程序,您需要包括springbootstarterweb,以便获得springmvc、jackson和springbootstarter。 没有必要同时使用两者。如果您将使用SpringBootStarterWeb,那么对于您的应用程序来说就足够了。但是,使用这两种方法都不会导致错误