DEV Community

Cover image for A Brief Introduction to Spring Boot
Abdur Rehman Khalid
Abdur Rehman Khalid

Posted on

A Brief Introduction to Spring Boot

Introduction

Spring Boot is the MVC framework written in the Java, that simplifies the building of the large enterprise level applications simpler. Spring Boot helps to organize the code in a format that helps the developers working on a very large project. It provides flexibility in the development of new features independently due to support of Microservices architecture, Spring Boot is also a base for the many legacy projects as well. It is worth to invest time in order to learn this excellent frameworks that can benefit everyone in the long run or if you are someone who wants to combine the modern tech stacks with the legacy programming language Java. Spring Boot is the modern framework, if you look a little back you can find the Spring MVC as well.

Spring Boot has many other parts, it contains Spring Cloud that further contains things like Load Balancer, Messaging Queue and Spring Security that can check the integrity of the JWT and other things related to the access of the RESTful API it all depends upon the project needs and demands.

History and Early Development

Main Idea for Spring Boot came into existence in October, 2012. It all started when Mike Youngstrom made a request to make the bootstrapping for the Spring Framework and in the 2013 Spring Boot was made.

If go back further we can see that first version of Spring Framework was written by Rod Johnson in the October 2003 but it took around one year to make the production release of the Spring Framework.

Architecture Introduction

Architecture of the Spring Boot can be divided into 4 basic layers which are described as following:

  1. Presentation Layer.
  2. Business Layer.
  3. Persistence Layer.
  4. Database Layer.

Now Let's have a look at what is the function of each layer.

1. Presentation Layer
This layer contains the view that the user will be interacting with, so it is a kind of Front-End view that user can interact with and the very next layer is connected with this layer. HTTP requests are generated from this page that goes to Back-End for the processing and after processing the result is sent to the Front-End.

2. Business Layer
This layer contains the Business Rules implementation that are important for conducting business, and this layers mostly contains the Services in which different logics are implemented either checking the format of Email or if the Customer is Present in the Database or not all these kind of things are present in this layer.

3. Persistence Layer
Now here we are calling all the methods that will help to store or retrieve the data from the Database. If JPA is being used than we already have some methods available that can facilitate working with Database and at the end it will save a lot of time as well.

4. Database Layer
Now here we have different entities(will be tables in the database) so the data is retrieved and stored for the practical purposes. This layer is directly connected with the Database and Database can be MySQL, NoSQL, MongoDB or PSQL as well. Hibernate is being used then there is no need to worry about database.

Arct Example

HTML Frameworks supported

Almost all modern Front-End or JavaScript Frameworks will work almost perfectly fine, but there are some other Native Java Frameworks that can also work perfectly fine as well. This means that if you are not into specific Front-End framework then you can still use the Spring Boot writing Plane HTML and CSS using the following Frameworks:

  1. Vaadin (In this Framework, you don't even required HTML Knowledge)
  2. Thymleaf

These are the basic frameworks that can be used alongside Spring Boot without any specific JavaScript framework knowledge.

Pros of Using Spring Boot

  1. Dependency Management is very easy.
  2. Implementation of Design Patterns is very convenient.
  3. Structuring of the Project is easy to understand.
  4. Efficient in terms of the Time.
  5. No need to worry about setting of different SQL based Databases, because of ORMs.
  6. Availability of Huge Collection of Plugins.
  7. Availability of Microservices Architecture.

Cons of Using Spring Boot

  1. Deployment can be a little bit of Problem at first time.
  2. Setting up the development environment takes time.
  3. Wrong or careless entity management can create bottleneck on the front-end.
  4. Bad Developer experience due to large rebuild times.
  5. Have to restart after each change in order to observer the new changes.

Discussion (0)