Spring Boot – Getting Started

Spring Boot Essentials

1. Automatic Configuration

2. Starter Dependencies

3. Command Line Interface (CLI)

4. Actuator

1. Automatic Configuration

Spring Boot can automatically provide configuration for application functionality common to many Spring applications. Detailed explanation goes here…

2. Starter Dependencies

You tell Spring Boot what kind of functionality you need and it will ensure that the libraries needed are added to the build. Detailed explanation goes here…

3. Command Line Interface (CLI)

This optional feature of Spring Boot lets you write complete applications with just application code, but no need for a traditional project build. Detailed explanation goes here…

4. Actuator

Spring Boot’s Actuator gives you insight into the inner workings of a running
application. You can see exactly what beans are in the Spring application context, how
Spring MVC controllers are mapped to paths, the configuration properties available to
your application, and much more.
1. What beans have been configured in the Spring application context
2. What decisions were made by Spring Boot’s auto-configuration
3. What environment variables, system properties, configuration properties, and command-line arguments are available to your application
4. The current state of the threads supporting your application
5. A trace of recent HTTP requests handled by your application
6. Various metrics pertaining to memory usage, garbage collection, web requests, and data source usage

The Actuator offers production-ready features such as monitoring and metrics to Spring Boot applications. The Actuator’s features are provided by way of several REST endpoints, Exploring the Actuator’s endpoints 125 a remote shell, and Java Management Extensions (JMX). We’ll start by looking at the Actuator’s REST endpoints, which offer the most complete and well-known way of working with the Actuator.

Actuator’s Endpoints
Actuator Endpoints

To enable the Actuator endpoints, all you must do is add the Actuator starter to your build.

For a Maven build, the required dependency is as follows:

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

Spring Boot Applications can be created using

1. Spring Initializr
2. Command Line Interface (CLI)

Basics

1. @SpringBootApplication
Enable component-scanning and auto-configuration
@SpringBootApplication combines three other useful annotations:
1.1 @Configuration
1.2 @ComponentScan
1.3 @EnableAutoConfiguration

2. SpringApplication.run(MyApplication.class, args);
Bootstrap the application

3. Configuring application.properties
The application.properties file given to you by the Initializr is initially empty. In fact, this file is completely optional, so you could remove it completely without impacting the application. But there’s also no harm in leaving it in place.

Author: Mahesh

Technical Lead with 10 plus years of experience in developing web applications using Java/J2EE and web technologies. Strong in design and integration problem solving skills. Ability to learn, unlearn and relearn with strong written and verbal communications.