Differences between Spring and Spring Boot

Kasun Dissanayake
3 min readOct 12, 2022

--

In this tutorial, I am going to explain what are the main differences between Spring and Spring Boot. There are slight differences between Spring and Spring boots. Let's try to understand one by one and get a great idea about this topic.

Where we used Spring and Spring Boot?

Spring is an open-source lightweight framework widely used to develop enterprise applications.

Spring boot is relatively new and it is built on top of the conventional spring framework, widely used to develop Enterprise level applications with Rest APIs and CRUD.

Why we used Spring and Spring Boot?

Spring is a little bit old and it helped to create loosely coupled applications. Before Spring came into the picture we struggled with tightly coupled objects. We used to create objects with the new keyword which creates a tightly coupled dependency between two objects. If the Garbage collector collected one object the dependent object should be collected. This is a problem. To solve this problem a solution came up with a new concept called a dependency injection which is the task of creating and managing objects handled by the spring. You just need to auto-wire objects then the spring container will do that for you. You don't need to do that manually.

Since developers are lazy they needed something quick. To that, they introduced RAD(Rapid Application Development Model). It is a Spring module that provides the RAD (Rapid Application Development) and it is used to create a stand-alone Spring-based application that you can just run fast because it needs minimal Spring configurations. Here Spring Boot comes into the picture.

What are the server configurations needed?

In Spring applications we need to set the server explicitly like Tomcat and Jetty.

Spring Boot provides embedded servers such as Tomcat and Jetty etc. You can just use it. The default one is Tomcat. If you want to change it you can exclude it from the pom.xml and include the servers which you want.

Boilerplate Code

To create a Spring application, the developers write lots of boilerplate code again and again.

In Spring Boot we compress a whole bunch of code into a Jar and we added into the starter dependency packages. The whole task that is to be repeated again and again is already in the Jar, you just have to use it. It reduces the boilerplate code.

In Memory Database

Spring doesn’t provide an in-memory database like the H2 database.

Spring Boot provides support for the in-memory database such as H2. The in-memory database relies on system memory as opposed to disk space for storing data. Because memory access is faster than disk access. We use an in-memory database when we do not need to persist the data. The in-memory database is an embedded database. The in-memory databases are volatile, by default, and all stored data is lost when we restart the application.

Dependencies

Spring requires a lot of dependencies to create a web app.

Spring Boot, on the other hand, can get an application working with just one starter dependency. Started dependency is a package of multiple JARs. Just by including this started dependency in the pom.xml, all the required dependencies are found on the internet and they are loaded into your application M2 folder.

XML Configuration

Spring requires a lot of XML Configurations.

No need for XML Configuration in Spring Boot.

Plugins

Spring does not provide any plugins to build your application (Plugins for Maven, Gradle, etc.)

In Spring boot you can always add build plugins in your pom.xml. The plugins offer a variety of features, including the packaging of executable JARs.

I hope you got a better understanding and knowledge of the differences between Spring and Spring Boot. See you in another article.

Thank You!

--

--

Kasun Dissanayake
Kasun Dissanayake

Written by Kasun Dissanayake

Senior Software Engineer at IFS R & D International || Former Software Engineer at Pearson Lanka || Former Associate Software Engineer at hSenid Mobile

Responses (1)