zoukankan      html  css  js  c++  java
  • SpringBoot Actuator

    SpringBoot Actuator 提供了检查项目内部信息的一整套API,通常在项目启动时可以看到。

    1.引入依赖包

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

    2.配置application.yml

    management:
      address: 127.0.0.1 #只有当配置了port,bind-address才会生效.
      port: 8091
      security:
        enabled: true # 默认为true,生产环境必须设为true;这个值影响health接口的返回内容,设为true时,health接口只返回{status:up}
      context-path: /actuator   # 统一actuator的路径前缀,统一探活接口:/actuator/health
      health:
        defaults:
        # 为false只检查应用本身的健康状态;为true会对磁盘状态的进行检查
        # 但只有management.security.enabled=false时,才会返回磁盘空间的状态
          enabled: false # 默认true,检查磁盘空间
        diskspace:
          enabled: true # 默认true,设为false,不返回磁盘状态
          path: D:// # 只检查应用本身的健康状态,为true会对磁盘状态的进行检查,如果这个磁盘路径是不存在的,程序启动会报错
    # spring-boot 1.4.3 没有鉴权机制
    # 默认 sensitive 是 true,但会被management.security.enabled=false 覆盖
    endpoints:
      enabled: false # 默认true,打开所有接口,设为false,关闭所有接口(包含health),但单个接口可以独立打开
      health:
        enabled: true # 默认true,打开接口
      trace:
        enabled: false # 默认true,设为false,访问/actuator/health 返回404
        sensitive: false # 默认true, 设为false就可以关闭鉴权
      beans:
        enabled: false # 默认true,打开接口
        sensitive: false # 默认true,设为false就可以关闭鉴权
      metrics:
        enabled: false # 默认true,打开接口
        sensitive: true # 默认true,设为false就可以关闭鉴权
      info:
        enabled: false # 默认true,打开接口
        sensitive: false # 默认true,设为false就可以关闭鉴权
      heapdump:
        enabled: false # 默认true,打开接口
        sensitive: false # 默认true,设为false就可以关闭鉴权
    

      

      

  • 相关阅读:
    ORACLE-游标数
    Hibernate-原生SQL查询
    超链接无效
    首页统计脚本
    About_datebase
    PHP的学习--cookie和session--来自copy_02
    终于懂浏览器里面的cookies和session了
    About-PHP-02
    php链接数据库
    PHP 操作MySQL———来自copy
  • 原文地址:https://www.cnblogs.com/zhengwenqiang/p/9719569.html
Copyright © 2011-2022 走看看