What is the difference between Spring and Spring Boot?

The purpose of this tutorial is to clarify the differences between Spring and Spring Boot.

What is Spring framework ?

Spring is a light weight modular framework, based on the POJO model, that can be used for all layer implementations making the development of enterprise applications easier. The main reason behind the success of Spring can be summarized with:

  • Simplicity
  • Testability
  • Loose Coupling

At the heart of the Spring Framework there is the Inversion of Control, which is a programming pattern to achieve loose coupling where the independent objects don’t responsible for their dependencies. The IoC container receives metadata from either an XML file, Java annotations, or Java code and inversion of control container.

Although Spring was lightweight in terms of component code, it was heavyweight in terms of configuration. Initially, everything in Spring was configured with XML. Then, Spring 2.5 introduced annotation-based component-scanning, which eliminated part of the explicit XML configuration. Next, Spring 3.0 introduced a Java-based configuration as a type-safe and refactorable option to XML.

Even so, it was a no real escape from configuration. Enabling certain Spring features Spring MVC or transaction management still required explicit configuration, either in XML or Java. The same goes for third-party library features such as Thymeleaf-based web views, or configuring servlets and filters.

All of that configuration represents development friction. The mental shift required to manage the configuration of a Spring feature, distracts from solving the business problem.

Moreover, dependency management is another form of friction. When you’re adding dependencies to your build, you’re not writing application code. Any incompatibilities that come from selecting the wrong versions of those dependencies can be slow down your productivity a lot. Here comes Spring Boot.

What is Spring Boot instead ?

We will start saying that Spring Boot is not a framework and one could do everything using Spring Framework that can be achieved by Spring Boot. Spring Boot, in practice, is a way to ease to create Spring Based applications with minimal or zero configurations. How can this happen ? because Spring Boot provides defaults for code and annotation configuration to quick start new Spring projects in no time. Spring Boot leverages existing spring modules as well as third party projects to create production ready applications. One way to simplify application development is providing a set of “starters” Pom/Gradle build files to facilitate auto configuration of dependencies.

In a nutshell, Spring Boot is a rapid application development platform, based on an opinionated instance of a Spring application.

Example: suppose user is creating a web application using the Spring MVC pattern, then it’s obvious that he will need a Web server like Tomcat to deploy this application. By providing out of the box an Tomcat, as you add a “web” starter to your project, will save a lot of time & effort in installing, configuring their Tomcat instance. On the other hand, if you don’t want this default Web server, then Spring Boot has the flexibility to plug-in another easily, like for example Undertow.

Some of the main advantages of developing applications with Spring Boot are:

  • It reduces lots of development time and increases productivity.
  • It makes very easy to develop Spring Based applications with Java or Groovy.
  • It avoids spending time in writing lots of boilerplate Code, Annotations and XML Configuration.
  • It is very easy to integrate Spring Boot Application with its Spring Ecosystem like Spring JDBC, Spring ORM, Spring Data, Spring Security etc.
  • Spring Boot includes a powerful CLI (Command Line Interface) tool to develop and test Spring Boot application and a Cloud Web application to create new projects
  • Spring Boot follows “Opinionated Defaults Configuration” Approach to reduce Developer effort
  • Spring Boot provides lots of plugins to work with embedded and in-memory Databases very easily.
  • Spring Boot includes non-functional requirements, such as the Spring Boot Actuator (a module that brings metrics, health checks, and management easily) and embedded containers for running web applications (such as Tomcat, Undertow, Jetty, etc.)
Found the article helpful? if so please follow us on Socials
Twitter Icon       Facebook Icon       LinkedIn Icon       Mastodon Icon