Components of Spring Boot

Fig : Components of Spring Boot

Spring Boot Starters :

  • Spring Boot Starter reduces defining many dependencies.
  • It simplifies the process of building a project by automatically defining dependencies.
  • Spring Boot offers many starter modules to quickly get started with spring boot project.
  • These starters are pre-configured with the most commonly used library dependencies so you don’t have to search for the compatible library versions and configure them manually
  • For example, the spring-boot-starter-data-jpa starter module includes all the dependencies required to use Spring Data JPA, along with Hibernate library dependencies, as Hibernate is the most commonly used JPA implementation

Fig : Spring Boot Starter Web

Spring Boot Autoconfiguration:

  • Spring Boot AutoConfigurator reduces the Spring Configuration.
  • It address the problem of configurations by eliminating the need to manually set up the boilerplate configuration.
  • Spring Boot takes an opinionated view of the application and configures various components automatically, by registering beans based on various criteria. The criteria can be:
    • Availability of a particular class in a classpath
    • Presence or absence of a Spring bean
    • Presence of a system property
    • Absence of a configuration file

For example, If you have any embedded database drivers in the classpath, such as H2 or HSQL, and if you haven’t configured a DataSource bean explicitly, then Spring Boot will automatically register a DataSource bean using in-memory database settings.

@SpringBootApplication = @Configuration + @ComponentScan + @EnableAutoConfiguration

Spring Boot Actuator

  • Actuator is a tool which has HTTP endpoints.
  • Actuator used to monitor and manage our application.
  • When application is pushed to production, you can choose to manage and monitor your application using HTTP endpoints.
  • Spring Boot Actuator automatically provides hostname as “localhost” and default port number as “8080”.
  • We can access this application using “http://localhost:8080/” end point.

Spring Boot CLI

  • Spring Boot CLI(Command Line Interface) is a Spring Boot software to run and test Spring Boot applications from command prompt.
  • When we run Spring Boot applications using CLI, then it internally uses Spring Boot Starter and Spring Boot AutoConfigurate components to resolve all dependencies and execute the application.
  • We can run even Spring Web Applications with simple Spring Boot CLI Commands.
  • Spring Boot CLI has introduced a new “spring” command to execute Groovy Scripts from command prompt.