springboot与spring比较区别

Crq
Crq
Crq
324
文章
0
评论
2021年5月2日02:06:48
评论
460 902字阅读3分0秒
摘要

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

一、看一下spring的全部项目

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

我们常用的也就是,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回去判断引入的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 家族的一个项目,他的目标是提高使用者的开发效率。

weinxin
我的微信
这是我的微信扫一扫
Crq
  • 本文由 发表于 2021年5月2日02:06:48
  • 转载请注明:https://www.cncrq.com/9159.html
Linux下如何实现与Internet时间同步 Linux教程

Linux下如何实现与Internet时间同步

关于时区的概念,其实初中地理课已经涉及,很多人都多少了解一些,可能只是细节搞不太清楚。为什么会将地球分为不同时区呢?因为地球总是自西向东自转,东边总比西边先看到太阳,东边的时间也总...
老炮儿教你在 Debian Linux上配置网桥 Linux教程

老炮儿教你在 Debian Linux上配置网桥

如何你想为你的虚拟机分配 IP 地址并使其可从你的局域网访问,则需要设置网络桥接器。默认情况下,虚拟机使用 KVM 创建的专用网桥。但你需要手动设置接口,避免与网络管理员发生冲突。
linux下安装python3.5.3的方式 Linux教程

linux下安装python3.5.3的方式

Python是一种面向对象的解释型计算机程序设计语言。Python具有丰富和强大的库。它常被昵称为胶水语言,能够把用其他语言制作的各种模块(尤其是C/C++)很轻松地联结在一起。那...
匿名

发表评论

匿名网友 填写信息

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: