二、Spring Boot基础

【学习Spring Boot基础,创建Spring Boot项目,讲解Spring Boot的配置,是学习Spring Cloud Alibaba的必知必会.

Spring Boot基础

快速创建应用  https://www.cnblogs.com/my-program-life/p/11592838.html

Spring Boot基础知识  https://www.cnblogs.com/my-program-life/p/11958428.html

补充知识: Spring Boot Actuator监控

pom.xml

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

监控指示器HealthIndicators

 常用端点

所有端点情况 https://docs.spring.io/spring-boot/docs/2.0.0.M3/reference/htmlsingle/#production-ready-endpoints

健康检查

/health 
作用:健康检查
status取值情况
UP:正常
DOWN :遇到了问题,不正常
OUT_OF_SERVICE:资源未在使用,或者不该去使用
UNKNOWN: 未知

显示health端点的详情

application.properties

# 显示health端点的详情
management.endpoint.health.show-details=always

 info信息

 配置

# 描述应用
info.app-name=spring-boot-demo
info.author=czy
info.email=XXXXX@com

激活所有的actuator端点

# 激活所有的actuator端点
management.endpoints.web.exposure.include=*

激活actuator指定端点 

# 激活actuator个别端点
management.endpoints.web.exposure.include=metrics,health

原文地址:https://www.cnblogs.com/my-program-life/p/12253009.html