Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between Spring MVC and Spring Core

Are Spring MVC and Struts MVC are alike? and in Spring MVC is it only presentation layer like struts MVC? Does Spring core is used in Spring MVC. could you please elaborate on how Spring Core is used in Spring MVC.

like image 300
Hemanth Peela Avatar asked Apr 04 '17 17:04

Hemanth Peela


1 Answers

Those are very broad questions and I will try to put them in simple terms.

Does Spring core is used in Spring MVC? How Spring Core is used in Spring MVC?

Yes, Spring MVC uses Spring core. First of all, Spring core is an IOC container which injects the dependencies into various bean classes (like your controller classes, Service classes, etc..). So, spring-mvc leverages the power of the IOC container (spring-core) to set up the web framework components like WebApplicationContext and resolving/creating ViewResolver objects, etc..

I suggest you can look here for a detailed understanding of how spring modules collaboratively work with each other.

Are Spring MVC and Struts MVC are alike? and in Spring MVC is it only presentation layer like struts MVC?

They both have few similarities like they follow FrontController pattern i.e., Spring uses DispatcherServlet and Struts uses ActionServlet. But spring offers much more configurations by using various components (like adapters, handlers, etc..) inside the web application, for example, you can easily configure which content needs to be consumed/produced from controllers. You can look here on this for a detailed explanation on the differences between both of these frameworks.

like image 168
developer Avatar answered Nov 04 '22 02:11

developer