Java Spring Framework vs. Spring MVC vs. Spring Boot


New to Java world? Confused about what is what? What is Spring? What is Spring MVC? What is Spring Boot? Let me “briefly” explain the differences and what they are used for.

What is Java Spring Framework?

Spring Framework is one of the most popular application development frameworks for Java. Spring Framework’s most important aspects are IOC (Inversion of Control) and Dependency Injection which is actually a way to achieve IOC (I will talk about these 2 in another post). Used properly, DI and IOC help us develop loosely coupled applications (which are easier to unit test).

Spring Framework contains a lot of features, which are well-organized in about twenty modules for added functionality and handling some common problems. Some examples:

  • Spring JDBC
  • Spring MVC
  • Spring AOP
  • Spring ORM
  • Spring JMS
  • Spring Test
  • Spring Expression Language (SpEL)

Aspect Oriented Programming is another strong side of Spring Framework. The key unit of modularity in Object Oriented Programming is the class, whereas in AOP the unit of modularity is the aspect. Dependency Injection helps you decouple your application objects from each other, while Aspect Oriented Programming helps you decouple cross-cutting concerns from the business logic and the objects that they affect.

Spring Framework also provides integration with very powerful other frameworks like JUnit (unit testing), Hibernate (ORM) etc.


What is Spring MVC?

Spring MVC is a Web Application development framework and is also a module of Spring Framework. It provides separation of concerns and a decoupled way of developing web applications. It is a component that lets you implement your web application according to the model-view-controller design pattern. You could say Spring Framework is the superset of Spring MVC or Spring MVC is a subset of Spring Framework.


What is Spring Boot?

Spring applications need you to provide a lot of configurations to work properly. Spring MVC, Hibernate/JPA etc. all require their own configurations. Spring Boot brings some intelligence into configuration business like auto-configuring a Data Source if Hibernate jar is on the classpath or auto-configuring a Dispatcher Servlet if Spring MVC jar is on the classpath. So yes. Spring Boot provides auto-configuration for your Spring applications. Spring Boot favors convention over configuration and is designed to get you up and running as quickly as possible.

Spring Boot also provides very handy starter projects. They increase productivity by providing configurations and defaults to reduce developer effort avoiding writing lots of boilerplate Code, Annotations, and XML Configuration.

Starters are a set of convenient dependency descriptors that you can include in your application. You get a one-stop-shop for all the Spring and related technology that you need, without having to hunt through sample code and copy paste loads of dependency descriptors. For example, if you want to get started using Spring and JPA for database access, just include the spring-boot-starter-data-jpa dependency in your project, and you are good to go.

Another thing, Spring Boot provides Embedded HTTP servers like Tomcat, Jetty etc. which you can package together with your apps to create executable war files.


Hope this helps.
Good Luck,