Key Components in Spring Boot

Spring Boot has the following key components to prepare the Spring boot applications.

  1. Spring Boot Starters.
  2. Spring Boot Auto Configurator.
  3. Spring Boot CLI
  4. Spring Boot Actuators

Spring Boot Starters

In Spring based applications, if we want to prepare web applications with the database interaction then we have to provide the following dependencies.

  • Maven: io.micrometer:micrometer-commons:1.12.3
  • Maven: io.micrometer:micrometer-observation:1.12.3
  • Maven: jakarta.servlet:jakarta.servlet-api:6.1.0-M2
  • Maven: org.apiguardian:apiguardian-api:1.1.2
  • Maven: org.junit.jupiter:junit-jupiter-api:5.11.0-M1
  • Maven: org.junit.jupiter:junit-jupiter-engine:5.11.0-M1
  • Maven: org.junit.platform:junit-platform-commons:1.11.0-M1
  • Maven: org.junit.platform:junit-platform-engine:1.11.0-M1
  • Maven: org.opentest4j:opentest4j:1.3.0
  • Maven: org.springframework:spring-aop:6.1.4
  • Maven: org.springframework:spring-beans:6.1.4
  • Maven: org.springframework:spring-context:6.1.4
  • Maven: org.springframework:spring-core:6.1.4
  • Maven: org.springframework:spring-expression:6.1.4
  • Maven: org.springframework:spring-jcl:6.1.4
  • Maven: org.springframework:spring-jdbc:6.1.4
  • Maven: org.springframework:spring-tx:6.1.4
  • Maven: org.springframework:spring-web:6.1.4
  • Maven: org.springframework:spring-webmvc:6.1.4

In the Spring based web applications, to get all the above dependencies we have to provide more dependencies configuration in the pom.xml file, it is very difficult to manage the pom file.

To overcome the above problem, Spring Boot has provided a solution in the form of Spring Boot Starters.

In Spring Boot, starter components are able to combine all the above dependencies into a single dependency in the form of a Starter dependency.

spring-boot-starter-web     

If we provide the Spring Boot Starter web dependency in the pom.xml file in Spring Boot applications then it is able to provide the following dependencies internally inside the Spring Boot application.

  1. Spring boot Starter
    • Spring-boot
    • Spring-boot-autoconfigure
    • Spring-boot-starter-logging
    • jakarta.annotation-api
    • Spring-core
    • snakeyaml
  1. Spring-web
  2. Spring-webmvc
  3. Spring-boot-starter-tomcat
  4. spring-boot-starter-json

—–
—–

Spring Boot Auto Configurator

In Spring , if we want to prepare web applications then we have to provide the following configurations inside the Spring configuration file.

  1. Handler Mappings
  2. View Resolvers

——–

——–

Along with all the above configurations we have to use annotations like @Configuration, @ComponentScan, @EnableAutoConfiguration,….

In Spring Applications, providing all the above configurations  and using all the above annotations will increase burden to the developers, here to reduce burden to the developers Spring Boot has provided an alternative in the form of  “Spring Boot Autoconfigurator”.

Spring Boot Autoconfigurator will provide all the basic configurations of the spring applications automatically without having the explicit configurations.

When we use “Spring-boot-starter-web” dependency in the pom.xml file, Automatically Spring Boot autoconfigurator will come and resolve all the View and ViewResolvers, Handle Mappings,… in the Spring Web MVC applications. 

In Spring Boot applications we are able to enable the Auto Configurations by using the annotation like @SpringBootApplication.

Where @SpringBootApplication annotation is able to provide the following annotations internally.

  1. @ComponentScan
  2. @SpringBootConfiguration
  3. @EnableAutoConfiguration

Spring Boot CLI

Spring Boot CLI[Command Line Interface] is a Spring software , it will provide a very good environment to run and test Spring Boot applications from the command prompt.

If we run Spring boot applications by using Spring Boot CLI then the Spring Boot CLI will use Spring Boot starters and Spring Boot Auto configurator in order to provide all the dependencies and all the default configurations inside the spring applications.

Spring Boot Actuators

Spring Boot actuators are providing a number of “Production Grade” or “Production Ready” features like metrics, Health checks,….

Spring Boot Actuators are able to provide a very good environment to manage and monitor our application by using the predefined Http endpoints, where endpoints are the URL in order to get the details of the application.

If we want to get the Spring Boot actuators support in the Spring Boot applications then we have to add the following dependency in pom.xml

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
<version>3.2.5</version>
</dependency>

Note: Spring Boot is able to provide an environment to defined custom endpoints also in order to get the customized production ready features.