Book Image

Spring Boot Cookbook

By : Alex Antonov
Book Image

Spring Boot Cookbook

By: Alex Antonov

Overview of this book

Table of Contents (15 chapters)
Spring Boot Cookbook
Credits
About the Author
Acknowledgment
About the Reviewers
www.PacktPub.com
Preface
Index

Writing custom health indicators


Knowing the state of the application that is running in the production, especially in a large-scale distributed system, is just as—if not more—important than having things such as automated testing and deployment. In today's fast paced IT world, we can't really afford much downtime, so we need to have the information about the health of the application at our fingertips, ready to go at a minute's notice. If the all-so-important database connections go down, we want to see it right away and be able to quickly remedy the situation; the customers are not going to be waiting around for long before they go to another site.

We will resume working on our BookPub application in the state as we left it in the previous chapter. In this recipe, we will add the necessary Spring Boot starters to enable the monitoring and instrumentation of our application and will even write our own health indicator.

How to do it…

  1. The first thing that we need to do is add a dependency on...