Spring Cloud Learning (eight) Spring Boot Admin

Spring Boot Admin for managing and monitoring the one or more programs Spring Boot

New spring-boot-admin-server

pom

<parent>
    <artifactId>spring-cloud-parent</artifactId>
    <groupId>com.karonda</groupId>
    <version>1.0.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>spring-boot-admin-server</artifactId>

<dependencies>
    <dependency>
        <groupId>de.codecentric</groupId>
        <artifactId>spring-boot-admin-starter-server</artifactId>
        <version>RELEASE</version>
    </dependency>
    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
    </dependency>
</dependencies>

<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>
    </plugins>
</build>

spring-boot-admin-starter-server need to specify the version number

application.yml

server:
  port: 8071

eureka:
  client:
    service-url:
      defaultZone: http://localhost:8001/eureka/

spring:
  application:
    name: admin-server

Startup class

@EnableAdminServer // 开启 Admin Server
@EnableEurekaClient
@SpringBootApplication
public class AdminServerApp {
    public static void main(String[] args){
        SpringApplication.run(AdminServerApp.class, args);
    }
}

eureka-client

Add dependent

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

Register Spring Boot Admin (SBA) client, there are two ways: one is by introducing SBA Client (spring-boot-admin-starter-client); the other is based Spring Cloud Discovery, without adding dependent

Add application.xml

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

test

  1. Start eureka-server
  2. Start config-server
  3. Start eureka-client
  4. Start admin-server

Visit http: // localhost: 8071

Complete code: GitHub

I Java C # turn the newbie, please correct me if wrong or insufficient, thank you

Guess you like

Origin www.cnblogs.com/victorbu/p/11031166.html