spring-boot-starter-web 与 spring-boot-starter的区别

spring-boot-starter-webspring-boot-starter 是 Spring Boot 中常用的两个依赖,它们之间存在一些区别。

  1. spring-boot-starter-web

    • spring-boot-starter-web 是用于构建基于 Spring MVC 的 Web 应用程序的起步依赖。它包含了在开发 Web 应用时所需的大部分依赖,例如 Spring MVC、Tomcat(内嵌的 Servlet 容器)、Jackson(用于 JSON 处理)、Spring Web 等。如果您正在构建一个 Web 应用程序,可以使用该起步依赖来简化项目的配置。
  2. spring-boot-starter

    • spring-boot-starter 是一个更通用的起步依赖,它提供了 Spring Boot 应用程序所需的核心功能和自动配置。它包含了 Spring Core、自动配置、日志系统等核心模块。当您使用 spring-boot-starter 时,您需要根据实际需求选择其他具体功能的起步依赖,例如 spring-boot-starter-webspring-boot-starter-data-jpaspring-boot-starter-security 等。

因此,spring-boot-starter-web 更专注于支持 Web 应用开发所需的依赖,而 spring-boot-starter 则提供了更通用的核心功能和自动配置,适用于各种类型的应用程序。在实际项目中,根据您的需求可以选择使用其中之一或两者同时引入,以简化项目依赖管理和配置。

结论:当您使用 spring-boot-starter 作为起步依赖时,您需要根据项目的实际需求选择并引入其他具体功能的起步依赖。这样可以避免手动管理大量的依赖项,并且能够利用 Spring Boot 的自动配置功能,快速搭建符合需求的应用程序。

  • 6
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
区别是什么? 回答: spring-boot-starterspring-boot-starter-web是两个常的spring-boot-starter模块。spring-boot-starter是用于启动和提供日志功能的模块,它包含了一些常的功能和依赖。而spring-bootarter-web则是在-boot-starter的基础添加了Web开发相关的功能,例如处理HTTP请求和响应等。所以如果只需要启动项目或使用日志功能,可以使用spring-boot-starter;如果需要进行Web开发,可以使用spring-boot-starter-web来获得更多的功能和依赖。另外,许多spring-cloud-*的maven依赖中也包含了spring-boot-starter,因此在使用这些依赖时,通常不需要单独引用spring-boot-starter模块。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* *3* [spring-boot-starterspring-boot-starter-web的关联](https://blog.csdn.net/m0_67402774/article/details/126505778)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 50%"] - *2* [spring-boot-starter-logging和spring-boot-starter-web](https://blog.csdn.net/javaheheda/article/details/104974759)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值