- 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.
- 工程軟件開(kāi)發(fā)技術(shù)基礎(chǔ)
- 移動(dòng)UI設(shè)計(jì)(微課版)
- 自己動(dòng)手實(shí)現(xiàn)Lua:虛擬機(jī)、編譯器和標(biāo)準(zhǔn)庫(kù)
- Software Testing using Visual Studio 2012
- Kali Linux Wireless Penetration Testing Beginner's Guide(Third Edition)
- PHP編程基礎(chǔ)與實(shí)例教程
- 執(zhí)劍而舞:用代碼創(chuàng)作藝術(shù)
- C語(yǔ)言開(kāi)發(fā)基礎(chǔ)教程(Dev-C++)(第2版)
- Java圖像處理:基于OpenCV與JVM
- 運(yùn)維前線:一線運(yùn)維專家的運(yùn)維方法、技巧與實(shí)踐
- Mastering Adobe Captivate 7
- 愛(ài)上C語(yǔ)言:C KISS
- Android系統(tǒng)下Java編程詳解
- 寫(xiě)給大家看的Midjourney設(shè)計(jì)書(shū)
- 和孩子一起學(xué)編程:用Scratch玩Minecraft我的世界