Maven 依赖 spring-web 与 spring-webmvc
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/13533700/
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
Maven dependency spring-web vs spring-webmvc
提问by Mahendran
What is the difference between the following dependencies?
以下依赖项有什么区别?
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>3.1.2.RELEASE</version>
</dependency>
vs
对比
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>3.1.2.RELEASE</version>
</dependency>
If I include spring-webmvcalone then spring-webis implicitly added.
如果我spring-webmvc单独包含,则spring-web隐式添加。
When should we use spring-webalone?
什么时候应该spring-web单独使用?
回答by Tomasz Nurkiewicz
spring-webprovides core HTTP integration, including some handy Servlet filters, Spring HTTP Invoker, infrastructure to integrate with other web frameworks and HTTP technologies e.g. Hessian, Burlap.
spring-web提供核心 HTTP 集成,包括一些方便的 Servlet 过滤器、Spring HTTP Invoker、与其他 Web 框架和 HTTP 技术(例如 Hessian、Burlap)集成的基础设施。
spring-webmvcis an implementation of Spring MVC. spring-webmvcdepends onon spring-web, thus including it will transitively add spring-web. You don't have to add spring-webexplicitly.
spring-webmvc是 Spring MVC 的一个实现。spring-webmvc依赖于上spring-web,因此包括它会传递性增加spring-web。您不必spring-web明确添加。
You should depend only on spring-webif you don't use Spring MVC but want to take advantage of other web-related technologies that Spring supports.
您应该仅依赖于spring-web您是否不使用 Spring MVC 但希望利用 Spring 支持的其他与 Web 相关的技术。
回答by LiLi
From the official doc: The spring-web module provides basic web-oriented integration features such as multipart file upload functionality and the initialization of the IoC container using Servlet listeners and a web-oriented application context. It also contains an HTTP client and the web-related parts of Spring's remoting support.
来自官方文档:spring-web 模块提供了基本的面向 Web 的集成功能,例如多部分文件上传功能以及使用 Servlet 侦听器和面向 Web 的应用程序上下文初始化 IoC 容器。它还包含一个 HTTP 客户端和 Spring 远程支持的 Web 相关部分。
The spring-webmvc module (also known as the Web-Servlet module) contains Spring's model-view-controller (MVC) and REST Web Services implementation for web applications. Spring's MVC framework provides a clean separation between domain model code and web forms and integrates with all of the other features of the Spring Framework.
spring-webmvc 模块(也称为 Web-Servlet 模块)包含 Spring 的模型-视图-控制器 (MVC) 和用于 Web 应用程序的 REST Web 服务实现。Spring 的 MVC 框架在域模型代码和 Web 表单之间提供了清晰的分离,并与 Spring 框架的所有其他功能集成。
The spring-webmvc-portlet module (also known as the Web-Portlet module) provides the MVC implementation to be used in a Portlet environment and mirrors the functionality of the Servlet-based spring-webmvc module.
spring-webmvc-portlet 模块(也称为 Web-Portlet 模块)提供了要在 Portlet 环境中使用的 MVC 实现,并反映了基于 Servlet 的 spring-webmvc 模块的功能。

