Maven依赖spring-web vs spring-webmvc


问题内容

以下依赖项之间有什么区别?

<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-webmvc</artifactId>
    <version>3.1.2.RELEASE</version>
</dependency>

<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-web</artifactId>
    <version>3.1.2.RELEASE</version>
</dependency>

如果我spring-webmvc单独包含,spring-web则被隐式添加。

我们spring-web什么时候应该单独使用?


问题答案:

spring-web 提供核心的HTTP集成,包括一些方便的Servlet过滤器,Spring HTTP
Invoker,与其他Web框架和HTTP技术(例如Hessian,Burlap)集成的基础结构。

spring-webmvc是Spring MVC的实现。spring-webmvc
依赖于spring- web,因此包括它会传递性增加spring-web。您不必spring-web显式添加。

spring-web如果您不使用Spring MVC,但想利用Spring支持的其他与Web相关的技术,则应该仅依赖于此。