我正在尝试在 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 包含以下依赖项:
使用 IntelliJ,您可以在项目结构的底部查看工件的依赖关系。
鉴于 spring-boot-starter 是 spring-boot-starter-web 的一个依赖项,两者兼而有之是没有用的。如果你同时保留两者都不会造成任何伤害,只是没有必要。
关于 Spring 初始化 : spring-boot-starter vs spring-boot-starter-web,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54453745/