springboot必知必會

springBoot是什麼?能做什麼?
   是一個快速開發的腳手架。
   作用: 快速創建獨立的,生產級的基於spring的應用程序。 

特性:
   無需部署war文件;
   提供starter簡化配置;
   儘可能自動配置Spring以及第三方庫;
   提供“生產就緒功能”,如指標,健康檢查,外部配置等;
   無代碼生成,無XML配置;

springboot應用組成分析:
   依賴: pom.xml  (springboot-maven-plugin)
   啓動類: 註解
   配置: application.properties
   static目錄: 靜態文件
   templates目錄:模板文件(freemarker,groovy,thymeleaf,mustache)

spirngboot actuator:監控springboot應用程序的。
   /actuator/health: 健康檢查,檢查資源 status{up:正常,down: 不正常,out_of_service:未使用,unkown: 未知}
      配置: management.endpoint.health.show-details = always
   /actuator/info: 應用描述端口;
      配置: info.app-name = xxx;
   激活所有的actuator配置: 
      management.endpoints.web.exposure.indclude= *
   常用端點及描述:
    conditions    自動配置的信息    對應springboot1.x的 autoconfig
    beans        顯示程序上下文中所有的spirng bean
    configprops    顯示所有@ConfigurationProperties的配置屬性列表
    dump        顯示線程活動的快照
    env        顯示環境變量,包括系統環境變量以及應用環境變量
    health        顯示應用程序的健康指標
    heapdump    堆dump
    info        顯示應用的信息
    loggers    顯示日誌級別
    mappings    顯示所有url路徑
    metrics        顯示應用的度量標準信息
 

發佈了326 篇原創文章 · 獲贊 153 · 訪問量 12萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章