chapter four

4 Spring Boot – autoconfiguration and actuator

 

This chapter covers

  • Introduction to Spring Boot auto-configuration, various types of Conditional annotation, and in-depth discussion
  • An overview of Spring Boot devtools, how to configure, and its various purposes
  • Introduction to Spring Boot FailureAnalyzer, and how to define a custom application-specific FailureAnalyzer
  • An in-depth discussion on Spring Boot Actuator, and how to define custom metrics

You’ve already learned so much about Spring Boot in the last three chapters. With a solid foundation on Spring Boot, you’ve already seen various features of the framework, several common tasks that you need to perform on daily basis. Besides, you’ve also learned how to communicate and use a database in a Spring boot application.

In this chapter, you’ll explore two major concepts of Spring Boot – the Spring Boot auto-configuration and Spring Boot actuator. You’ll learn various building blocks of Spring Boot auto-configuration and explore how it works in an application. We’ll explore the various conditional annotation which is the foundation of Spring Boot auto-configuration. You’ll then explore the Spring Boot actuator which lets you monitor your application health and let you interact with it.

4.1 Understanding Spring Boot Auto-configuration

4.1.1 Motivation

4.1.2 Understanding @Conditional annotation

4.1.3 Deep Dive into Auto-configuration

4.2 Using Spring Boot DevTools

4.3 Creating Custom Failure Analyzer

4.4 Spring Boot Actuator

4.4.1 Configuring Spring Boot Actuator

4.4.2 Understanding Spring Boot Actuator Endpoints

4.4.3 Managing Spring Boot Actuator Endpoints

4.4.4 Health Endpoint Deep Dive

4.4.5 Creating a Custom Spring Boot HealthIndicator

4.4.6 Info Endpoint Deep Dive

4.4.7 Creating a Custom Spring Boot Actuator Endpoint

4.4.8 Spring Boot Actuator Metrics

4.4.9 Creating Custom Metrics

4.4.10 Metrics dashboard with Prometheus and Grafana

4.5 Chapter Summary