Maven依赖spring-web vs spring-webmvc

时间:2021-12-28 20:08:56

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

VS

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

If I include spring-webmvc alone then spring-web is implicitly added.

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

When should we use spring-web alone?

我们什么时候应该单独使用弹簧网?

1 个解决方案

#1


98  

spring-web provides 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技术,例如黑森,麻布。

spring-webmvc is an implementation of Spring MVC. spring-webmvc depends on on spring-web, thus including it will transitively add spring-web. You don't have to add spring-web explicitly.

spring-webmvc是Spring MVC的一个实现。 spring-webmvc取决于弹簧网,因此包括它将传递添加弹簧网。您不必显式添加spring-web。

You should depend only on spring-web if you don't use Spring MVC but want to take advantage of other web-related technologies that Spring supports.

如果您不使用Spring MVC但希望利用Spring支持的其他与Web相关的技术,那么您应该只依赖于spring-web。

#1


98  

spring-web provides 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技术,例如黑森,麻布。

spring-webmvc is an implementation of Spring MVC. spring-webmvc depends on on spring-web, thus including it will transitively add spring-web. You don't have to add spring-web explicitly.

spring-webmvc是Spring MVC的一个实现。 spring-webmvc取决于弹簧网,因此包括它将传递添加弹簧网。您不必显式添加spring-web。

You should depend only on spring-web if you don't use Spring MVC but want to take advantage of other web-related technologies that Spring supports.

如果您不使用Spring MVC但希望利用Spring支持的其他与Web相关的技术,那么您应该只依赖于spring-web。