阿里云-云小站(无限量代金券发放中)
【腾讯云】云服务器、云数据库、COS、CDN、短信等热卖云产品特惠抢购

springboot与spring比较区别

33次阅读
没有评论

共计 1089 个字符,预计需要花费 3 分钟才能阅读完成。

导读 面试的时候经常会被问到,spring 和 springboot 的区别。或者 SpringMVC 和 Springboot 的区别。其实这样的问法就不是特别合适。因为 spring、springboot、springmvc 他们三个在 spring 体系中就不在同一个维度。
一、看一下 spring 的全部项目

spring 家族 有很多项目,springboot、spring framework、spring cloud 等。

springboot 与 spring 比较区别

我们常用的也就是,springboot、springcloud、springsecurity、springdata。常说的 springmvc 只是 spring framework 的特性之一。

二、springboot 核心能力

1、内嵌 Servlet 容器,可以直接打成 jar 包,通过 java -jar xx.jar 运行项目。

2、提供 starter pom 系列,简化 maven 的依赖加载,减少依赖冲突的发生。

3、支持自动化配置,如下图。application.properties 文件在引入 springboot 和未引入 springboot 时,是不一样的。

springboot 与 spring 比较区别

实现的源码:springboot 回去判断引入的 jar 包是否有 spring.factories 文件

@EnableAutoConfiguration
@Import({AutoConfigurationImportSelector.class})
protected List getCandidateConfigurations(AnnotationMetadata metadata, AnnotationAttributes attributes) {List configurations = SpringFactoriesLoader.loadFactoryNames(this.getSpringFactoriesLoaderFactoryClass(), this.getBeanClassLoader());
  Assert.notEmpty(configurations, "No auto configuration classes found in META-INF/spring.factories. If you are using a custom packaging, make sure that file is correct.");
  return configurations;
}

springboot 与 spring 比较区别

总结:springboot 是 spring 家族的一个项目,他的目标是提高使用者的开发效率。

阿里云 2 核 2G 服务器 3M 带宽 61 元 1 年,有高配

腾讯云新客低至 82 元 / 年,老客户 99 元 / 年

代金券:在阿里云专用满减优惠券

正文完
星哥说事-微信公众号
post-qrcode
 0
星锅
版权声明:本站原创文章,由 星锅 于2024-07-25发表,共计1089字。
转载说明:除特殊说明外本站文章皆由CC-4.0协议发布,转载请注明出处。
【腾讯云】推广者专属福利,新客户无门槛领取总价值高达2860元代金券,每种代金券限量500张,先到先得。
阿里云-最新活动爆款每日限量供应
评论(没有评论)
验证码
【腾讯云】云服务器、云数据库、COS、CDN、短信等云产品特惠热卖中