Spring Boot Admin Client 搭建过程

开始搭建Admin Client,其实很简单的,只需要添加相应依赖,配置文件添加一些配置就可以。
步骤1:添加依赖

<dependency>
   <groupId>de.codecentric</groupId>
    <artifactId>spring-boot-admin-starter-client</artifactId>
    <version>2.1.0</version>
</dependency>
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-actuator</artifactId>
</dependency>

步骤2:bootstrap.yml添加配置信息

#Actuator配置:暴露敏感路径,默认情况下,敏感路径并不暴露
management:
  endpoints:
    web:
      exposure:
        # 暴露xxx端点,如需暴露多个,用,分隔;如需暴露所有端点,用'*'
        include: "*"
  endpoint:
    health:
      # 是否展示健康检查详情
      show-details: ALWAYS
spring:
    boot:
      admin:
        client:
          # server地址
          url: http://localhost:7070   

特别指出一下要是在application.properties中上面一行配置信息得这样写:

management.endpoints.web.exposure.include=*

一定没有"",不然就是一中错误的写法,如图:
在这里插入图片描述
最后启动项目
在这里插入图片描述
成功实现!

发布了22 篇原创文章 · 获赞 13 · 访问量 5773

猜你喜欢

转载自blog.csdn.net/weixin_43839457/article/details/99988085