springboot集成Admin「客户端」

501 阅读1分钟

上篇springboot集成Admin「服务端」已将Admin服务端搭建妥了。

客户端的搭建方式也十分简简单单,下面直接上代码。

一、客户端简单搭建

开发环境

  • Spring Boot:2.1.6.RELEASE
  • Spring Boot Admin Client:2.1.6

1. 引入POM依赖

        <dependency>
            <groupId>de.codecentric</groupId>
            <artifactId>spring-boot-admin-starter-client</artifactId>
            <version>2.1.6</version>
        </dependency>

2. application.yml 配置

server:
  port: 7002
  servlet:
    context-path: /springboot-admin-client
spring:
  application:
    name: springboot-admin-client
  boot:
    admin:
      client:
        url: http://localhost:7001/springboot-admin-server/
        username: 'admin'
        password: 'admin'
management:
  endpoints:
    web:
      exposure:
        include: '*'
  endpoint:
    health:
      show-details: always
logging:
  file: admin.log

启动服务后,访问:http://localhost:7001/springboot-admin-server/#/applications

二、监控信息

1. 服务概览

2. 度量指标信息,比如JVM、Tomcat及进程信息

3. 环境变量信息,比如系统属性、系统环境变量以及应用配置信息

4. 查看日志信息,需要添加以下配置才能开启

logging:
  file: admin.log