Spring Boot – An Overview

In this article let’s discuss the overview of Spring Boot. It is lightweight to Spring Framework. Spring Boot helps in simplifying the development process. It helps in the creation of standalone, production-ready applications easily; use of annotations, simplify setting up and configuring the services. Spring Boot provides us with a modern pattern for developing web applications with minimum efforts.

Why Spring to Spring Boot?

Spring framework being lightweight, was introduced as an alternative of Java Enterprise Edition. But, Spring framework turned out as a configuration that was heavy weight.

In-order to build a J2EE application with Spring framework one must follow the below rules;

  • A controller class that responds to HTTP requests
  • It should have WEB-INF folder
  • web.xml and it contains dispatcher servlet
  • finally a dedicated server (like Tomcat) for deploying applications and etc,.

Hence, in order to eliminate the above heavy weight rules, Spring Boot was introduced and it has changed all of this.

Spring Boot Features

This utility framework from the Spring team helps to bootstrap Spring based applications and micro-services quickly and easily. Below are the important features;

  • The requirement of traditional XML configuration is discarded.
  • It also makes it possible to develop micro-services by packaging all the required run-time dependencies in a big executable JAR file
  • It uses an opinionated approach over configurations for decision making, thereby will try to make the right type of application, (web/standalone). For a web application we can embed the servlet containers; like, tomcat or jetty.
  • Spring Boot Actuator provides us more than functional requirements. We can include modules that brings metrics, health checks for services, and these can be managed easily.
  • It has a Cloud Native Applications that follow the 12 factor patterns (developed by the Netflix engineering team at http://12factor.net/)
  • Spring Boot provides an easy mechanism for one to configure and use logging very simply.
  • Spring Boot supports Tomcat , Jetty , Undertow servlet containers.

Spring Boot Essentials

It is a tool that allows easy development of services. It has four core methods to help in development efficiently;

  • Automatic configuration
  • Starter dependencies
  • The command-line interface
  • The Actuator

Let’s look at these methods in high-level;

Automatic configuration

A Spring application consists of Java configuration, XML configuration or both which supports certain features and functionality for the Application. Spring Boot decides on the choice of these common configuration scenarios automatically. This auto-configuration of Spring Boot is a run-time process to be precise application startup time. What spring configuration should be used depends on several factors. Is Spring’s JdbcTemplate available on the class-path? If available, is there is a Data-source bean? If these are available then a JdbcTemplate bean is auto-configured.

Starter dependencies

Using starter dependencies project dependency management is controlled in Spring Boot. A starter dependency is a Maven POM that describes transitive dependencies on other libraries which gives support for some functionality.

The command-line interface

CLI is a discretional feature of Spring Boot. One can execute the code only after starting the application. Conventional project build is not necessary. It lets us to write complete applications with just application code.

The Actuator

Actuator in Spring Boot provides to analyse the internal process of web application at run-time. This information is exposed in two ways: through web endpoints or through a shell interface. Below details we can get using actuator;

  • What are the beans configured in the application context
  • Trace of HTTP requests over applications.
  • We can track how much memory is used by our services, garbage collection metrics, time taken to complete the web requests and data sources usage in the back-end.

Micro-service with Spring Boot

A fully qualified micro-services can be built using Spring Boot. It requires a different part of our system that’s independently deployable and decoupled.

The advantages and need of a micro-services, will be discussed in the upcoming Articles.

Let’s take a simple Payroll example and Payroll system can be built as a web application, which consists of different parts like,

  • Payroll calculation service, ( for calculating business logic)
  • Payslip service (for creating payslip),
  • Notification service (for sending notification)
Sprint Boot - Microservices - Example
Sprint Boot – Microservices – Example

So, our work can split up and we can maintain them with a small teams which makes work easier. Spring Boot is used to create micro services with ease. All services will communicate with each other to perform the desired task. As you can see, these reactive patterns provides us a lot of advantages for making our services. This architecture is called as event-driven architecture.

Event-Driven Architecture

Different micro-services send events among each other. This exchange occurs through message mediators called event bus. We will discuss more about this in upcoming Articles.

Before concluding this Article, let’s quickly summarize what we learned;

  • Spring Boot allows you to create applications without the requirement of any XML configuration. It doesn’t generate code.
  • Spring Boot uses an opinionated approach over configurations for decision making, thereby will try to make the right type of application, (web/standalone). For a web application we can embed the servlet containers like tomcat or jetty.

Now we have gone through the basics of Spring Boot. In the coming articles we will find more about creating simple applications and understanding the internals of Spring Boot and then we will learn creating more advanced applications.


Add a Comment

Your email address will not be published.