Saif
Saif

Reputation: 7042

Spring and Spring MVC -- are they two different framework?

As I am trying to learn some framework J2EE, I am studying on spring framework.

The thing that confused me in some tutorial they mention Spring MVC as a part of the spring framework. But at some place they mentioned as like a different and independent framework. some people even compare Spring MVC with Struts (which is another framework as i understand ).

Now how actually should i take Spring MVC in mind as a different framework like Struts or as a part of Spring?

Upvotes: 1

Views: 1181

Answers (3)

Evgeni Dimitrov
Evgeni Dimitrov

Reputation: 22506

Spring is a Java EE-like stack. The core Spring framework provides Dependency injection, AOP, JDBC helpers etc. Also there are a couple of sub-projects: Spring MVC, Spring batch, Integration etc. (See the full stack here: http://spring.io/projects) Yes Spring MVC is veri similar to Struts, as both are action oriented MVC frameworks. Usually the sub-projects depend on the core and not on the other sub-projects. The main point is that Spring is a stack of technologies.

Upvotes: 0

taringamberini
taringamberini

Reputation: 2747

Spring has incredibly grown in the last decade, so nowadays the single word Spring means different things depending on the context in which it is used. In such context might be used the following Spring projects.

One of these projects is the Spring Framework: an open source application framework and inversion of control container for the Java platform which offers lots of features:

  • Dependency Injection
  • Aspect-Oriented Programming including Spring's declarative transaction management
  • Spring MVC web application and RESTful web service framework
  • Foundational support for JDBC, JPA, JMS
  • Much more...

each one of these features is designed in a Spring Framework's module grouped in layers, so among others, you can find:

  • in the core layer
    • The Core and Beans modules provide the fundamental parts of the framework, including the IoC and Dependency Injection features.
    • ...
  • ...
  • in the web layer
    • ...
    • The Web-Servlet module contains Spring' s model-view-controller (MVC) implementation for web applications. Spring's MVC framework provides a clean separation between domain model code and web forms, and integrates with all the other features of the Spring Framework.
    • ...
  • ..

Your question

Now how actually should i take Spring MVC in mind as a different framework like Struts or as a part of Spring?

Both are right because of what summarized above: Spring includes Spring Projects and one of them is Spring Framework which contains Spring's MVC framework.

So if you think the single word Spring both as the most general and as the Spring Framework, Spring MVC is part of Spring.

Moreover you may consider Spring MVC like Struts, because Spring's MVC framework application domain is extremely closed to the Struts one.

I think your confusion comes up from considering a part (Spring's MVC framework) as different from the whole (the most general single word Spring or the Spring Framework) in which the part may be thought included.

Upvotes: 5

Mateusz Odelga
Mateusz Odelga

Reputation: 354

Spring in common meaning is framework provided by spring-core artifact [http://mvnrepository.com/artifact/org.springframework/spring-core]. Contains IoC, Dependency Injections and other stuff.

Spring MVC using Spring to bootstrap application context, and add some functionality and features specified to MVC. You should think about Spring MVC as 'plugin' or 'extension' of Spring.

Upvotes: 1

Related Questions