Java Spring 和 Spring MVC 框架有什么区别

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/23320747/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-13 21:52:44  来源:igfitidea点击:

what is the difference between Spring and Spring MVC framework

javaspring

提问by Naveen

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

我是春天的新手。任何人都可以让我知道 Spring 和 Spring MVC Framework 之间有什么区别吗?

回答by Aniket Thakur

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 是一个第三方库。只需要在lib目录下放入必要的jar文件,并定义几个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 时,它只是一个框架。通过框架,我的意思是很多功能/罐子。就像您可能拥有具有核心功能或 aspectj 等的核心一样。 Spring MVC 即模型视图控制器是 Spring 框架提供的一种此类功能。您可以根据请求的 URL 模式将请求的处理推迟到各种控制器。你可以参考

Spring MVC hello world example

Spring MVC hello world 示例

回答by Michal

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 应用程序的组件。

回答by Sardor I.

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框架中的一个组件,用于支持Web应用的开发。

回答by Salman

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

弹簧框架

Framework vs. Toolkit vs. Library

框架 vs. 工具包 vs. 库

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 架构

回答by Salman

MVC is a Spring module. You use it for designing web applications. MVC in Spring implements the front controller design pattern. In your web.xmlyou'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)。

回答by Dexter

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, Tapestryetc, i.e. Presentation layer framework.

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

Spring framework is the super set of Spring MVC.

Spring 框架是 Spring MVC 的超集。