Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Maven dependency spring-web vs spring-webmvc

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-webmvc alone then spring-web is implicitly added.

When should we use spring-web alone?

like image 891
Mahendran Avatar asked Nov 23 '12 17:11

Mahendran


People also ask

What is spring-Webmvc dependency?

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.

What is spring web maven dependency?

Spring Web provides 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 remote support. License. Apache 2.0. Categories.

What is spring web dependency in spring boot?

Starter of Spring web uses Spring MVC, REST and Tomcat as a default embedded server. The single spring-boot-starter-web dependency transitively pulls in all dependencies related to web development. It also reduces the build dependency count.


2 Answers

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-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.

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.

like image 136
Tomasz Nurkiewicz Avatar answered Oct 24 '22 13:10

Tomasz Nurkiewicz


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.

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.

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.

https://docs.spring.io/spring/docs/4.3.22.RELEASE/spring-framework-reference/htmlsingle/#overview-web

like image 24
LiLi Avatar answered Oct 24 '22 14:10

LiLi