【學習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