- Learning Spring Boot 2.0(Second Edition)
- Greg L. Turnquist
- 231字
- 2021-07-02 15:18:07
Adding production-ready support
We've created a Spring web app with minimal code and released it to production. This is the perfect time to introduce production-grade support features.
There are some questions that often arise in production, and these are as follows:
- What do we do when the system administrator wants to configure his or her monitoring software to ping our app to see if it's up?
- What happens when our manager wants to know the metrics of people hitting our app?
- What are we going to do when the ops center supervisor calls us at 2:00 a.m. and we have to figure out what went wrong?
The last feature we are going to introduce in this chapter is Spring Boot's Actuator module. This module provides some super slick Ops-oriented features that are incredibly valuable in a production environment.
We start by adding this dependency to our build.gradle as follows:
compile('org.springframework.boot:spring-boot-starter-actuator')
When you run this version of our app, the same business functionality is available that we saw earlier, but there are additional HTTP endpoints; these are listed in the following table:

Endpoints, by default, are disabled. We have to opt in. This is accomplished by setting endpoints.{endpoint}.enabled=true inside src/main/resources/application.properties, like this:
endpoints.health.enabled=true
This line added to application.properties mentions the endpoint, health, and enables it. If we restart the application, we can ping for its health, as shown in the next section.
- 深入核心的敏捷開發(fā):ThoughtWorks五大關(guān)鍵實踐
- Microsoft System Center Orchestrator 2012 R2 Essentials
- Elasticsearch for Hadoop
- jQuery Mobile移動應(yīng)用開發(fā)實戰(zhàn)(第3版)
- Android應(yīng)用案例開發(fā)大全(第二版)
- Django 3.0入門與實踐
- Node學(xué)習(xí)指南(第2版)
- Qt5 C++ GUI Programming Cookbook
- 零基礎(chǔ)學(xué)C++(升級版)
- 你真的會寫代碼嗎
- 零基礎(chǔ)學(xué)編程系列(全5冊)
- 算法超簡單:趣味游戲帶你輕松入門與實踐
- 劍指大數(shù)據(jù):企業(yè)級電商數(shù)據(jù)倉庫項目實戰(zhàn)(精華版)
- Azure for Architects
- Mastering VMware vSphere Storage