了解SpringApplication
SpringApplication是Spring Boot 引導啟動類,與Spring上下文、事件、監聽器以及環境等元件關系緊密,其中提供了控制Spring Boot 應用特征的行為方法.
Spring Boot 應用運作監聽器是SpringApplicationRunListener
了解Spring Boot事件
事件觸發器:EventPublishingRunListener
applicationStartedEvent
ApplicationEnvironmentPreparedEvent
ApplicationPreparedEvent
ApplicationReadyEvent
ApplicationReadyEvent/ApplicationFailedEvent
了解Spring Boot/Spring Clound 上下文層次關系
Spring Boot上下文
- 非Web應用:AnnotationConfigApplicationContext
-
Web應用:AnnotationConfigEmbeddedWebApplicationContext
Spring Cloud 上下文:Bootstrap(父)
Actuator Endpoints
了解Actuator Endpoints
Actuator中文直譯為"傳動裝置",在Spring Boot 使用場景中表示為"生産而準備的特性"(Production-reatures),這些特性通過HTTP端口的形式,幫助相關人員管理和監控應用。大緻上可以歸類為:
- 監控類:"端點資訊"、"應用資訊"、"外部化配置資訊"、"名額資訊"、"健康檢查"、"Bean管理"、"Web URL 映射管理"、"Web URL跟蹤"
-
管理類:"外部化配置"、"日志配置"、"線程dump"、"堆dump"、"關閉應用"
注意:Spring Boot 1.5開始 Actuator增強了安全能力
Spring Cloud學習之路(二)
重點
解決辦法:關閉安全認證
配置檔案添加management.security.enabled=false
- bean管理 導航欄端口後/beans
- 映射管理 導航欄端口後/mappings
- 配置項 導航欄端口後/env
- 健康檢查 導航欄端口後/health
- 硬體名額 導航欄端口後 /metrics
Spring Cloud擴充Actuator Endpoints
- 上下文重新開機 導航欄端口後/restart
- 暫停 導航欄端口後 /pause
-
恢複 導航欄端口後/resume
下一章我們進行學習