Clear Confusion: Spring MVC vs Spring Boot Differences

In this post, I’m happy to share with you the differences between Spring MVC and Spring Boot, which are probably the confusing concepts for those who are new in Java Spring development. 

1. Spring MVC vs. Spring Boot: What are they?

Let’s get started with what Spring MVC and Spring Boot are actually about. 

What is Spring MVC? 

Spring MVC is a web framework built on Java Servlet stack. It simplifies and enriches the development of web applications running on servlet containers such as Apache Tomcat. 
Spring MVC is a part of Spring Framework Core, which is a sub project under the Spring platform’s umbrella. 
Developers can use Spring MVC for developing web apps for synchronous or asynchronous request/response processing model, RESTful webservices and REST APIs.

What is Spring Boot? 

Spring Boot is an opinionated way that helps developers get started with Spring framework with minimum effort. Spring Boot makes it easy to create stand-alone, production-grade Spring-based applications. 

Spring Boot is also a part of Spring platform. Developers use Spring Boot to save time and increase productivity in developing Spring-based projects running as standalone programs (with embedded server).

2. Spring MVC vs Spring Boot: Features Comparison

Having said that, you can use Spring Boot to create webapps that are based on Spring MVC. Let’s understand their key features. 

The key features of Spring MVC are: 

  • Dispatcher Servlet (front controller) and Model View Controller (MVC) design patterns
  • Handler mappings, annotated controllers
  • Form handling & Form validation
  • View resolution; view solvers for exception, locale, theme, logging…
  • Integration with Spring Security, Servlet Async API, view technologies (Thymeleaf, FreeMarker, JSP, JSTL, PDF, Excel…)

And you know, Spring MVC is well known for having boilerplate code with lots of XML configurations. The following picture illustrates the logical architecture of a Spring MVC-based application: 

spring mvc architecture 

Whereas, thekey features of Spring Boot are

  • Stand-alone applications with embedded server. No need for WAR deployment
  • Starter dependencies that simplify dependency management
  • Automatic configuration of Spring and 3rd party libraries
  • Production-ready features: metrics, health check, externalized configuration

And you know, Spring Boot frees developers from boilerplate code and XML configuration. No code generation. No XML configs. The following picture illustrates the logical architecture of a Spring Boot application: 

spring boot architecture 

3. Spring MVC vs Spring Boot: Conclusion

So far you have probably understood the relation and differences between Spring MVC and Spring Boot. Let me sum up a few things: 

  • Both Spring MVC and Spring Boot are parts of the Spring platform
  • Spring Boot is not a replacement of Spring MVC
  • Spring Boot eases the development of Spring-based apps, including ones based on Spring MVC
  • A Spring MVC-only app needs to be packaged into a WAR file which is then deployed on a Servlet container such as Apache Tomcat
  • A Spring Boot-powered app could run as a standalone program with embedded servlet container
  • Today, developers prefer using Spring Boot to develop Spring MVC-based applications 

Learn more:  

Tutorials series:

posted @ 2023-03-27 17:38  HelloMarsMan  阅读(18)  评论(0编辑  收藏  举报