Key Components of Spring Boot

In my previous articleΒ Spring Boot Tutorial , I have covered the introduction of Spring Boot , Its advantages, limitations, goals, features etc. Now we will cover here the basic components of Spring Boot and the working of Spring Boot.

If you have not read my introduction article of Spring Boot, I would request you to take a look – Β Spring Boot Tutorial.

Key Components or Modules of Spring Boot

There are four main components / modules exists in Spring Boot Framework :

  1. Spring Boot Starters
  2. Spring Boot AutoConfigurator
  3. Spring Boot CLI
  4. Spring Boot Actuator

The above mentioned are the main components of Spring Boot framework, However there are two other components exists in Spring Boot, which are :

  1. SpringΒ Initializr
  2. Spring Boot IDEs

Key Components of Spring Boot

Let’s discuss all these components in depth :

Spring Boot Starters

Spring Boot Starters is considered as one of the most important component of Spring Boot framework. Spring Boot starter basically groups the related or transitive dependencies into single dependency.

Spring Boot framework provides many built-in starters which makes the application’s development fast and easy.

Suppose , we are developing an application using Spring framework then below jars are minimally needed in your application to use Spring framework :

  • Spring core dependency
  • Spring web mvc
  • Servlet jars etc.

Though above dependencies are related but still we are required to add a lot of dependencies in our build file , this not only takes time but it also increase the size of build file.

Spring Boot has solution for this problem.

Spring Boot starter combines all related dependencies into single dependency. Instead of adding above mentioned dependencies we are required only to add below dependency in Spring Boot:

<!-- Parent pom is mandatory to control versions of child dependencies --> <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>2.1.8.RELEASE</version> <relativePathΒ /> </parent> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> The above dependency in Spring Boot project will automatically download all required jars and will add to your classpath.

Key Components of Spring Boot

There exists other Spring Boot starter dependencies :

  • spring-boot-starter-security (Starter dependency for Spring security)
  • spring-boot-starter-test (Starter dependency for test of Spring boot application)
  • spring-boot-starter-logging (Starter dependency for logging using Logback)

Β Advantages of Spring Boot Starter component

  • Spring Boot Starter simplifies the project build dependencies.
  • Spring Boot Starter ease and fasten the development of Spring application.

In our coming articles, we will discuss the Spring Boot Starter component in depth with more details and examples.

Spring Boot AutoConfigurator

Spring Boot AutoConfigurator is also one of the important component of Spring Boot framework. As we know, when we develop Spring application, we need to add a lot of configurations whether XML configurations or Annotation configuration.
This does takes a lot of time and effort.

Spring Boot comes up with solution for this problem.

Spring Boot AutoConfigurator component’s main purpose is to reduce the configurations as it was needed in Spring framework.
Developing applications with Spring Boot becomes easy and fast as we are not required to maintain any XML configuration and annotation configuration is sometimes required very minimal.
Spring Boot AutoConfigurator provides all these required information to the framework.

Suppose, we need to create a Spring web mvc application then we are required to defined many configuartions like views and view resolvers etc. But in Spring Boot, this is taken care by the Spring Boot AutoConfigurator component and we are not required to add these configurations manually.

Spring Boot also reduces the requirement of defining Annotations configurations.

We only required to add the annotation @SpringBootApplicationΒ at class level and then Spring Boot AutoConfigurator component will automatically add all required annotations to Java Class’ ByteCode.

Below is the definition ofΒ @SpringBootApplication :


@Target(value=TYPE)

@Retention(value=RUNTIME)

@Documented

@Inherited

@Configuration

@EnableAutoConfiguration

@ComponentScan

public @interface SpringBootApplication

In our coming articles, we will discuss the Spring Boot AutoConfigurator component in depth with more details and examples.

Spring Boot CLI

Spring Boot comes up with a new software or tool which is known as Spring Boot CLI (Command Line Interface).
Spring Boot CLI tool is used to run and test the Spring Boot application from command prompt.

The Spring Command Line interface internally uses Spring Boot Starter and Spring Boot AutoConfigurate component to resolve the dependencies and to execute the application. It is very easy to run the Spring web applications using the Spring Boot CLI.

Spring Boot CLI component requires below mentioned steps :

  • CLI Installation
  • CLI Setup
  • Develop the Spring Boot application
  • Test the application

In our coming articles, we will discuss the Spring Boot CLI component in depth with more details and examples.

Spring Boot Actuator

Spring Boot Actuator component is very essential to Spring Boot as it provides many features.
Two major features or responsibility of this component is :

  • To provide Management EndPoints to Spring Boot Applications.
  • Spring Boot Application Metrics.

Spring Boot Actuator automatically provides the hostname and port number as “localhost” and “8080” respectively, whenever we use CLI to run the Spring Boot application. That application can be accessed using the url “http://localhost:8080/”.

HTTP Request methods – GET and POST are used for representing Management EndPoints using Spring Boot Actuator.

In our coming articles, we will discuss the Spring Boot Actuator component in depth with more details and examples.

Spring initializr

Spring initializr is a web interface which is used to quick start new Spring Boot projects.

Spring Initializr from Spring team is provided here.

In our coming articles, we will discuss the Spring Boot initializr component in depth with more details and examples.

Spring Boot IDEs

Spring Boot supports many IDEs like Eclipse , IntelliJ IDEA, Spring STS etc.

In our coming articles, we will discuss the Spring Boot IDEs in depth with more details and examples.

Conclusion

That’s all folks! In this article,Β  we have learnt the key components or modules of Spring Boot framework.

Newsletter Updates

Enter your name and email address below to subscribe to our newsletter

Leave a Reply