日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

在spring boot 配置actuator

發(fā)布時間:2025/7/14 编程问答 48 豆豆
生活随笔 收集整理的這篇文章主要介紹了 在spring boot 配置actuator 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

spring boot 通過actuator 來提供應(yīng)用服務(wù)器信息。例如可以通過health 查看存儲信息,服務(wù)器是否正常運行 通過metrics可以觀察heap, mem等信息。 方便用戶監(jiān)控應(yīng)用


1 在pom.xml 添加actuator 依賴

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


2 在application.properties ?配置詳細(xì)信息

management.context-path=/manage endpoints.health.sensitive=false endpoints.metrics.sensitive=false endpoints.info.sensitive=falsemanagement.context-path=/manage endpoints.health.sensitive=false endpoints.metrics.sensitive=false endpoints.info.sensitive=false #config?info?details info.app.name=MyApp info.app.description=descript?for?the?project info.build.groupId=@project.groupId@ info.build.artiface=@project.artifactId@ info.build.version=@project.version@ info.app.encoding=@project.build.sourceEncoding@ info.app.java.source=@java.version@ info.app.java.target=@java.version@


3 測試這里我配置了/manage 為actuator的根路徑

輸入localhost:8080/manage/health

{"status":"UP","diskSpace":{"status":"UP","total":255534821376,"free":107373064192,"threshold":10485760},"db":{"status":"UP","database":"Oracle","hello":"Hello"}}

輸入localhost:8080/manage/metrics

{"mem":374672,"mem.free":112188,"processors":4,"instance.uptime":182778,"uptime":199229,"systemload.average":-1.0,"heap.committed":310272,"heap.init":253952,"heap.used":198083,"heap":3592192,"nonheap.committed":66176,"nonheap.init":2496,"nonheap.used":64401,"nonheap":0,"threads.peak":33,"threads.daemon":31,"threads.totalStarted":40,"threads":33,"classes":7965,"classes.loaded":7967,"classes.unloaded":2,"gc.ps_scavenge.count":12,"gc.ps_scavenge.time":233,"gc.ps_marksweep.count":2,"gc.ps_marksweep.time":139,"httpsessions.max":-1,"httpsessions.active":0,"gauge.response.star-star":12.0,"gauge.response.manage.health":935.0,"counter.status.404.star-star":2,"counter.status.200.manage.health":1}


轉(zhuǎn)載于:https://blog.51cto.com/jamesdev/1876764

總結(jié)

以上是生活随笔為你收集整理的在spring boot 配置actuator的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。