maven依赖版本查询网站:

https://mvnrepository.com/

一、服务端
1、maven依赖

<dependency>
            <groupId>de.codecentric</groupId>
            <artifactId>spring-boot-admin-server</artifactId>
            <version>3.3.3</version>
        </dependency>
        <dependency>
            <groupId>de.codecentric</groupId>
            <artifactId>spring-boot-admin-server-ui</artifactId>
            <version>3.3.3</version>
        </dependency>

2、配置文件

server:
  port: 8888

3、启动类添加@EnableAdminServer注解

@EnableAdminServer // @EnableAdminServer注解启动Admin服务器
@SpringBootApplication
public class SpringbootAdminApplication {

    public static void main(String[] args) {
        SpringApplication.run(SpringbootAdminApplication.class, args);
    }

}

二、客户端
1、安装客户端依赖,注意和服务端版本一致

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

2、配置文件

spring:
  application:
    name: xxxxxx

  boot:
    admin:
      client:
        url: http://127.0.0.1:5555
        register-once: false
        instance:
          service-host-type: ip

management:
  endpoints:
    web:
      exposure:
        include: "*"
  endpoint:
    health:
      show-details: ALWAYS
    shutdown:
      enabled: true

三、浏览器http://localhost:8888后可看到页面

在这里插入图片描述

Logo

腾讯云面向开发者汇聚海量精品云计算使用和开发经验,营造开放的云计算技术生态圈。

更多推荐