Springboot actuator端点配置与及基本说明2.2.4版

pom配置

<parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.2.4.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>
    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

配置文件

# 该项目信息说明,通过actuator/info 查看
info:
  name: 描述  
  contact: test
server:
  port: 8080 #默认端口配置,可以不配置

启动类

@SpringBootApplication
public class ActuatorApp {
    public static void main(String[] args) {
        //通过构建器启动
        new SpringApplicationBuilder(ActuatorApp.class).web(WebApplicationType.SERVLET).run(args);
        //WebApplicationType.REACTIVE reactive web application
        //WebApplicationType.SERVLET  servlet-base web applicaiton
        //WebApplicationType.NONE non web applicaiton
        //SpringApplication.run(ActuatorApp.class,args); //默认启动一个 servlet web applicaiton
    }
}

访问actuator查看端点

http://localhost:8080/actuator

默认只有四个
在这里插入图片描述

http://localhost:8080/actuator/info  #信息来源 yml中  info

在这里插入图片描述

开启所有端点

management:
  endpoints:
    web:
      exposure:
        include:  *  # * 所有端点, beans, env, health 可以配置Endpoint IDs,其他都关闭

在这里插入图片描述

其他端点信息与说明,建议查看官网文档

https://docs.spring.io/spring-boot/docs/2.2.4.RELEASE/reference/html/production-ready-features.html#production-ready
在这里插入图片描述在这里插入图片描述在这里插入图片描述在这里插入图片描述

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值