I am new to Spring. Can any one let me know what is the difference between Spring and Spring MVC Framework ?
Spring
An umbrella term to denote various projects, one of which is Spring Framework.
Spring MVC
The Spring Framework
project has several features. One of them is Spring MVC
.
Features of Spring Framework
are -
Core Technologies: Dependency Injection, validation, data binding, type conversion, SpEL
, AOP
etc.
Testing
Data Access: Transactions, DAO support, JDBC
, ORM
etc.
Spring MVC and Spring WebFlux web frameworks.
Integration: JMS
, JMX
, email, scheduling etc.
Languages: Kotlin
, Groovy
, dynamic languages.
So, the Spring MVC
feature allows developers to build applications following Model-view-controller design pattern using Spring Framework
.
Other Spring projects
Spring Boot: For creating stand-alone Spring
applications using Convention over configuration design paradigm.
Spring Data: For creating Spring
-based programming model for data access. It has various modules like Spring Data JDBC, Spring Data JPA, Spring Data MongoDB etc.
Spring Security: Powerful and highly customizable authentication and access-control framework for both Authentication and Authorization.
And many other projects.
NOTE
Spring
, Spring Framework
and Spring MVC
these terms are often used interchangeably among developers which sometimes creates confusion for people who already don't know the details.
MVC is a Spring module. You use it for designing web applications. MVC in Spring implements the front controller design pattern. In your web.xml
you'll define a single servlet (DispatcherServlet) and all your requests will pass through it and will be attended by Controllers you will define (@Controller
).
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 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 MVC can be thought of as an replacement to Struts, Stripes, Tapestry etc, i.e. Presentation layer framework.
Spring framework is the super set of Spring MVC.
1- Spring in abstract word is a framework
The Spring Framework is an open source application framework and inversion of control container for the Java platform.
Check this links for more information:
Spring Framework
Framework vs. Toolkit vs. Library
2- MVC architecture
it is an architecture that help the developer to separate the building block of web application.
Model View Controller or MVC as it is popularly called, is a software design pattern for developing web applications
check this link for more information: Basic MVC Architecture
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.
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 MVC hello world example