Spring Boot vs. Spring MVC: What's the difference?
The key difference between Spring Boot and Spring MVC is that Spring Boot is a software development accelerator that helps developers create preconfigured Spring applications from over 100 Spring projects and libraries, while Spring MVC is simply one of the Spring-based projects you can choose from.
Spring and the Spring framework
Ever since the Spring framework was released in 2004, dozens of projects have emerged that build on top of the Spring dependency injection and inversion of control container. Some of the most popular ones include the following:
- Spring Data and JPA.
- Spring REST and HATEOAS.
- Spring security.
- Spring JDBC and H2.
- Spring AI with OpenAPI.
Spring Web MVC and Spring Boot
However, the most popular Spring project of all, due largely to its support for RESTful web services, is Spring Web, and that's the project that includes Spring's MVC web framework.
As you can see, Spring MVC is simply one of the many popular technologies developers can include in their Spring-based projects.
Since most modern applications require a RESTful API, most Spring-based microservices include the Spring Web project, so annotations such as Spring MVC's Controller and RestController will be available.
However, developers don't have to include Spring Web MVC in their microservices. It's entirely acceptable to create cloud-native applications without including Spring Web MVC support. The Spring Web project -- and the Spring Web MVC technology it contains -- is never required.
Spring Boot and Spring MVC
There are many ways to assemble a software development project that uses Spring. Developers can download JAR files, manage dependencies with Gradle or edit a Maven POM file, but none of these approaches are particularly easy.
For large projects that use multiple Spring projects, and potentially integrate with multiple back-end databases or other external resources, configuration can be a challenge. That's where Spring Boot comes in.
Spring Boot provides developers with a graphical interface, known as the Spring Initializr, which software architects use to choose Spring projects and external technologies their projects will support. Spring Boot then creates a skeleton application with the selected projects and technologies preconfigured and working.
Spring Boot helps teams quickly get their Spring applications bootstrapped, thus the name Spring Boot.
Difference between Spring MVC and Spring Boot
Spring MVC is a popular technology, packaged inside the Spring Web starter project, that helps teams build server-side web apps and RESTful APIs.
On the other hand, Spring Boot is a project accelerator that helps teams build a basic Spring-based application that uses the projects and technologies they want, which may or may not include Spring MVC. That's the key difference between Spring Boot and Spring MVC.
Cameron McKenzie has been a Java EE software engineer for 20 years. His current specialties include Agile development; DevOps; Spring; and container-based technologies such as Docker, Swarm and Kubernetes.