最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

spring監(jiān)視器actuator配置應(yīng)用

 更新時(shí)間:2023年07月08日 09:31:56   作者:back2childhood  
這篇文章主要介紹了spring監(jiān)視器actuator配置應(yīng)用,本文通過(guò)實(shí)例代碼給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下

引入依賴(lài)

<!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-actuator -->
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-actuator</artifactId>
    <version>3.1.0</version>
</dependency>

配置

# actuator
# 將所有路徑都加入監(jiān)視
management.endpoints.web.exposure.include=*
# 將某幾個(gè)路徑取消監(jiān)控
management.endpoints.web.exposure.exclude=info,caches

應(yīng)用

自帶的路徑

localhost:8080/mycommunity/actuator/health

在這里插入圖片描述

自定義路徑

@Component
@Endpoint(id = "database")
public class DatabaseEndpoint {
    private static final Logger logger = LoggerFactory.getLogger(DatabaseEndpoint.class);
    @Autowired
    private DataSource dataSource;
    // readOperation means this method can only be accessed by get request
    // writeOperation means this method can only be accessed by post request
    @ReadOperation
    public String checkConnection(){
        try(
                Connection connection = dataSource.getConnection();
           ) {
            return CommunityUtil.getJSONString(0,"success");
        } catch (SQLException e) {
            e.printStackTrace();
            logger.error("failed");
        }
        return CommunityUtil.getJSONString(1, "failed");
    }
}

訪(fǎng)問(wèn)瀏覽器:localhost:8080/mycommunity/actuator/database

注意actuator路徑只能對(duì)管理員訪(fǎng)問(wèn),注意做權(quán)限管理

到此這篇關(guān)于spring監(jiān)視器actuator的文章就介紹到這了,更多相關(guān)spring監(jiān)視器內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

最新評(píng)論

菏泽市| 贡觉县| 沙坪坝区| 寿宁县| 壤塘县| 克拉玛依市| 临澧县| 稷山县| 西盟| 三原县| 基隆市| 曲松县| 东兴市| 东明县| 邯郸市| 宜君县| 桑日县| 黄梅县| 屏东市| 大同县| 平塘县| 盖州市| 基隆市| 会理县| 南平市| 胶南市| 高平市| 视频| 静安区| 万荣县| 彩票| 宝应县| 枣庄市| 赞皇县| 平舆县| 柏乡县| 东平县| 射洪县| 涿鹿县| 壤塘县| 宁晋县|