Spring和Spring MVC框架有什么区别

时间:2022-01-18 20:08:25

I am new to Spring. Can any one let me know what is the difference between Spring and Spring MVC Framework ?

我是Spring的新手。任何人都可以告诉我Spring和Spring MVC Framework有什么区别?

7 个解决方案

#1


29  

Spring is a big framework, that contains a lot of components. One of these components is Spring MVC - it is a component that lets you implement your web application according to the model-view-controller design pattern.

Spring是一个很大的框架,它包含很多组件。其中一个组件是Spring MVC - 它是一个允许您根据模型 - 视图 - 控制器设计模式实现Web应用程序的组件。

#2


18  

1- Spring in abstract word is a framework

1-抽象词中的Spring是一个框架

The Spring Framework is an open source application framework and inversion of control container for the Java platform.

Spring Framework是一个开源的应用程序框架和Java平台的控件容器的反转。

Check this links for more information:

查看此链接以获取更多信息:

Spring Framework

Spring框架

Framework vs. Toolkit vs. Library

框架与工具包与库

2- MVC architecture

2 MVC架构

it is an architecture that help the developer to separate the building block of web application.

它是一种架构,可以帮助开发人员分离Web应用程序的构建块。

Model View Controller or MVC as it is popularly called, is a software design pattern for developing web applications

模型视图控制器或MVC,因为它被广泛称为,是用于开发Web应用程序的软件设计模式

check this link for more information: Basic MVC Architecture

查看此链接以获取更多信息:基本MVC架构

#3


10  

MVC is a Spring module. You use it for designing web applications. MVC in Spring implements the front controller design pattern. In your web.xml you'll define a single servlet (DispatcherServlet) and all your requests will pass through it and will be attended by Controllers you will define (@Controller).

MVC是一个Spring模块。您可以使用它来设计Web应用程序。 Spring中的MVC实现了前端控制器设计模式。在您的web.xml中,您将定义一个servlet(DispatcherServlet),您的所有请求都将通过它,您将定义的控制器(@Controller)将参与其中。

#4


8  

Spring is a framework which helps to connect different components together. There are many modules for IOC, AOP, Web MVC etc.Spring Framework is an open source application framework and inversion of control container for the Java platform.

Spring是一个框架,有助于将不同的组件连接在一起。 IOC,AOP,Web MVC等有很多模块.Spring Framework是一个开源的应用程序框架和Java平台的控件容器的反转。

Spring MVC (Model–view–controller) is one component within the whole Spring Framework, to support development of web applications.

Spring MVC(Model-view-controller)是整个Spring Framework中的一个组件,用于支持Web应用程序的开发。

#5


5  

Spring MVC is one component within the whole Spring Framework, to support development of web applications. You can use any web containers, so it works fine with Tomcat. Just think that Spring is a third party library. You just need to put the necessary jar files in the lib directory, and define a few xml files.

Spring MVC是整个Spring Framework中的一个组件,用于支持Web应用程序的开发。您可以使用任何Web容器,因此它可以与Tomcat一起使用。试想Spring是第三方库。您只需要将必要的jar文件放在lib目录中,并定义一些xml文件。

So basically when you just say Spring it is a just a framework. And by framework I mean lot of functionalities/jars. Like you may have core which has core functionality or aspectj etc. Spring MVC i.e model view controller is one such functionality offered by Spring framework. You can deffer processing of request to various controllers based on the pattern of URL requested. You can refer

所以基本上当你说Spring时它只是一个框架。通过框架我的意思是很多功能/罐子。就像你可能拥有具有核心功能或方面等的核心一样.Spring MVC即模型视图控制器是Spring框架提供的一种功能。您可以根据请求的URL模式对各种控制器的请求进行处理。你可以参考

Spring MVC hello world example

Spring MVC你好世界的例子

#6


2  

Spring framework can be visualized as an alternative to, replacement for, or even addition to the Enterprise JavaBeans (EJB) model as mentioned here. That means a framework to develop distributed, scalable, secured, transactional application.

可以将Spring框架可视化为此处提到的Enterprise JavaBeans(EJB)模型的替代,替代或甚至添加。这意味着开发分布式,可扩展,安全,事务性应用程序的框架。

Spring MVC can be thought of as an replacement to Struts, Stripes, Tapestry etc, i.e. Presentation layer framework.

Spring MVC可以被认为是Struts,Stripes,Tapestry等的替代品,即表示层框架。

Spring framework is the super set of Spring MVC.

Spring框架是Spring MVC的超级集合。

#7


1  

Most often, when people say Spring, they mean the entire family of projects.

大多数情况下,当人们说Spring时,他们指的是整个项目系列。

The Spring Framework is divided into modules. Applications can choose which modules they need. At the heart are the modules of the core container, including a configuration model and a dependency injection mechanism. Beyond that, the Spring Framework provides foundational support for different application architectures, including messaging, transactional data and persistence, and web. It also includes the Servlet-based Spring MVC web framework and, in parallel, the Spring WebFlux reactive web framework.

Spring框架分为几个模块。应用程序可以选择所需的模块。核心是核心容器的模块,包括配置模型和依赖注入机制。除此之外,Spring Framework还为不同的应用程序体系结构提供了基础支持,包括消息传递,事务数据和持久性以及Web。它还包括基于Servlet的Spring MVC Web框架,以及Spring WebFlux响应式Web框架。

Basic MVC contains three layer - Model, View, Controller. In this case view is responsible for showing the model(data) to the end user and controller is the components which accept the requests and will do data fetching, request validations and transformations.

基本MVC包含三层 - 模型,视图,控制器。在这种情况下,视图负责向最终用户显示模型(数据),控制器是接受请求的组件,并将执行数据提取,请求验证和转换。

In Spring MVC the concept is extended to include other layers as well. When the user sends a request it is accepted by a dispatcher servlet. This acts like a main controller and pass the request to the relevant controller based on the request mappings, http methods or data format. Once this is done this controller can then do request validations, transformations, can fetch the data from db and then can create the model object. This controller will now return a logical view name. This logical view name is then used by view resolver to decide what should be the view to render the model for the end user. Once the view is decided it will be rendered and the model object data will be shown to the user.

在Spring MVC中,概念扩展到包括其他层。当用户发送请求时,调度程序servlet接受该请求。这类似于主控制器,并根据请求映射,http方法或数据格式将请求传递给相关控制器。完成此操作后,此控制器可以执行请求验证,转换,可以从db获取数据,然后可以创建模型对象。此控制器现在将返回逻辑视图名称。然后,视图解析器使用此逻辑视图名称来确定应为最终用户呈现模型的视图。一旦决定了视图,它将被渲染并且模型对象数据将被显示给用户。

#1


29  

Spring is a big framework, that contains a lot of components. One of these components is Spring MVC - it is a component that lets you implement your web application according to the model-view-controller design pattern.

Spring是一个很大的框架,它包含很多组件。其中一个组件是Spring MVC - 它是一个允许您根据模型 - 视图 - 控制器设计模式实现Web应用程序的组件。

#2


18  

1- Spring in abstract word is a framework

1-抽象词中的Spring是一个框架

The Spring Framework is an open source application framework and inversion of control container for the Java platform.

Spring Framework是一个开源的应用程序框架和Java平台的控件容器的反转。

Check this links for more information:

查看此链接以获取更多信息:

Spring Framework

Spring框架

Framework vs. Toolkit vs. Library

框架与工具包与库

2- MVC architecture

2 MVC架构

it is an architecture that help the developer to separate the building block of web application.

它是一种架构,可以帮助开发人员分离Web应用程序的构建块。

Model View Controller or MVC as it is popularly called, is a software design pattern for developing web applications

模型视图控制器或MVC,因为它被广泛称为,是用于开发Web应用程序的软件设计模式

check this link for more information: Basic MVC Architecture

查看此链接以获取更多信息:基本MVC架构

#3


10  

MVC is a Spring module. You use it for designing web applications. MVC in Spring implements the front controller design pattern. In your web.xml you'll define a single servlet (DispatcherServlet) and all your requests will pass through it and will be attended by Controllers you will define (@Controller).

MVC是一个Spring模块。您可以使用它来设计Web应用程序。 Spring中的MVC实现了前端控制器设计模式。在您的web.xml中,您将定义一个servlet(DispatcherServlet),您的所有请求都将通过它,您将定义的控制器(@Controller)将参与其中。

#4


8  

Spring is a framework which helps to connect different components together. There are many modules for IOC, AOP, Web MVC etc.Spring Framework is an open source application framework and inversion of control container for the Java platform.

Spring是一个框架,有助于将不同的组件连接在一起。 IOC,AOP,Web MVC等有很多模块.Spring Framework是一个开源的应用程序框架和Java平台的控件容器的反转。

Spring MVC (Model–view–controller) is one component within the whole Spring Framework, to support development of web applications.

Spring MVC(Model-view-controller)是整个Spring Framework中的一个组件,用于支持Web应用程序的开发。

#5


5  

Spring MVC is one component within the whole Spring Framework, to support development of web applications. You can use any web containers, so it works fine with Tomcat. Just think that Spring is a third party library. You just need to put the necessary jar files in the lib directory, and define a few xml files.

Spring MVC是整个Spring Framework中的一个组件,用于支持Web应用程序的开发。您可以使用任何Web容器,因此它可以与Tomcat一起使用。试想Spring是第三方库。您只需要将必要的jar文件放在lib目录中,并定义一些xml文件。

So basically when you just say Spring it is a just a framework. And by framework I mean lot of functionalities/jars. Like you may have core which has core functionality or aspectj etc. Spring MVC i.e model view controller is one such functionality offered by Spring framework. You can deffer processing of request to various controllers based on the pattern of URL requested. You can refer

所以基本上当你说Spring时它只是一个框架。通过框架我的意思是很多功能/罐子。就像你可能拥有具有核心功能或方面等的核心一样.Spring MVC即模型视图控制器是Spring框架提供的一种功能。您可以根据请求的URL模式对各种控制器的请求进行处理。你可以参考

Spring MVC hello world example

Spring MVC你好世界的例子

#6


2  

Spring framework can be visualized as an alternative to, replacement for, or even addition to the Enterprise JavaBeans (EJB) model as mentioned here. That means a framework to develop distributed, scalable, secured, transactional application.

可以将Spring框架可视化为此处提到的Enterprise JavaBeans(EJB)模型的替代,替代或甚至添加。这意味着开发分布式,可扩展,安全,事务性应用程序的框架。

Spring MVC can be thought of as an replacement to Struts, Stripes, Tapestry etc, i.e. Presentation layer framework.

Spring MVC可以被认为是Struts,Stripes,Tapestry等的替代品,即表示层框架。

Spring framework is the super set of Spring MVC.

Spring框架是Spring MVC的超级集合。

#7


1  

Most often, when people say Spring, they mean the entire family of projects.

大多数情况下,当人们说Spring时,他们指的是整个项目系列。

The Spring Framework is divided into modules. Applications can choose which modules they need. At the heart are the modules of the core container, including a configuration model and a dependency injection mechanism. Beyond that, the Spring Framework provides foundational support for different application architectures, including messaging, transactional data and persistence, and web. It also includes the Servlet-based Spring MVC web framework and, in parallel, the Spring WebFlux reactive web framework.

Spring框架分为几个模块。应用程序可以选择所需的模块。核心是核心容器的模块,包括配置模型和依赖注入机制。除此之外,Spring Framework还为不同的应用程序体系结构提供了基础支持,包括消息传递,事务数据和持久性以及Web。它还包括基于Servlet的Spring MVC Web框架,以及Spring WebFlux响应式Web框架。

Basic MVC contains three layer - Model, View, Controller. In this case view is responsible for showing the model(data) to the end user and controller is the components which accept the requests and will do data fetching, request validations and transformations.

基本MVC包含三层 - 模型,视图,控制器。在这种情况下,视图负责向最终用户显示模型(数据),控制器是接受请求的组件,并将执行数据提取,请求验证和转换。

In Spring MVC the concept is extended to include other layers as well. When the user sends a request it is accepted by a dispatcher servlet. This acts like a main controller and pass the request to the relevant controller based on the request mappings, http methods or data format. Once this is done this controller can then do request validations, transformations, can fetch the data from db and then can create the model object. This controller will now return a logical view name. This logical view name is then used by view resolver to decide what should be the view to render the model for the end user. Once the view is decided it will be rendered and the model object data will be shown to the user.

在Spring MVC中,概念扩展到包括其他层。当用户发送请求时,调度程序servlet接受该请求。这类似于主控制器,并根据请求映射,http方法或数据格式将请求传递给相关控制器。完成此操作后,此控制器可以执行请求验证,转换,可以从db获取数据,然后可以创建模型对象。此控制器现在将返回逻辑视图名称。然后,视图解析器使用此逻辑视图名称来确定应为最终用户呈现模型的视图。一旦决定了视图,它将被渲染并且模型对象数据将被显示给用户。