📜  Spring vs Spring Boot vs Spring MVC

📅  最后修改于: 2021-01-11 04:53:37             🧑  作者: Mango

Spring vs.Spring Boot与Spring MVC

Spring vs.Spring Boot

春季:春季框架是最流行的Java应用程序开发框架。 Spring框架的主要功能是依赖项注入控制反转(IoC)。借助于Spring Framework,我们可以开发一个松散耦合的应用程序。如果纯粹定义应用程序类型或特征,则最好使用。

Spring Boot: Spring Boot是Spring Framework的模块。它允许我们构建具有最少配置或零配置的独立应用程序。如果我们要开发一个简单的基于Spring的应用程序或RESTful服务,最好使用。

下面讨论Spring和Spring Boot之间的主要比较:

Spring Spring Boot
Spring Framework is a widely used Java EE framework for building applications. Spring Boot Framework is widely used to develop REST APIs.
It aims to simplify Java EE development that makes developers more productive. It aims to shorten the code length and provide the easiest way to develop Web Applications.
The primary feature of the Spring Framework is dependency injection. The primary feature of Spring Boot is Autoconfiguration. It automatically configures the classes based on the requirement.
It helps to make things simpler by allowing us to develop loosely coupled applications. It helps to create a stand-alone application with less configuration.
The developer writes a lot of code (boilerplate code) to do the minimal task. It reduces boilerplate code.
To test the Spring project, we need to set up the sever explicitly. Spring Boot offers embedded server such as Jetty and Tomcat, etc.
It does not provide support for an in-memory database. It offers several plugins for working with an embedded and in-memory database such as H2.
Developers manually define dependencies for the Spring project in pom.xml. Spring Boot comes with the concept of starter in pom.xml file that internally takes care of downloading the dependencies JARs based on Spring Boot Requirement.

Spring Boot与Spring MVC

Spring Boot: Spring Boot使快速引导和开始开发基于Spring的应用程序变得容易。它避免了很多样板代码。它在幕后隐藏了很多复杂性,因此开发人员可以快速上手并轻松开发基于Spring的应用程序。

Spring MVC: Spring MVC是用于构建Web应用程序的Web MVC框架。它包含许多用于各种功能的配置文件。这是一个面向HTTP的Web应用程序开发框架。

Spring Boot和Spring MVC的存在目的不同。下面讨论了Spring Boot和Spring MVC之间的主要比较:

Spring Boot Spring MVC
Spring Boot is a module of Spring for packaging the Spring-based application with sensible defaults. Spring MVC is a model view controller-based web framework under the Spring framework.
It provides default configurations to build Spring-powered framework. It provides ready to use features for building a web application.
There is no need to build configuration manually. It requires build configuration manually.
There is no requirement for a deployment descriptor. A Deployment descriptor is required.
It avoids boilerplate code and wraps dependencies together in a single unit. It specifies each dependency separately.
It reduces development time and increases productivity. It takes more time to achieve the same.