admin-server

本模块简单演示了Spring Boot Admin
本模块已将admin server注册为eureka客户端,所以不需要再增加admin client。
Spinrg Boot Admin可用于管理和监控基于Spring Boot的应用。

url desc
http://localhost:8090 spring boot admin ui

启用Spring Boot Admin

  • 引入Maven依赖

    1.5.0
    ...




    de.codecentric
    spring-boot-admin-server
    ${spring.boot.admin.server}


    de.codecentric
    spring-boot-admin-server-ui
    ${spring.boot.admin.server}




    org.springframework.cloud
    spring-cloud-starter-eureka

  • 配置应用\端口等

以下是bootstrap.yml中相关配置

spring:
  application:
    name: admin 
server:
  port: 8090

eureka:
  instance:
    leaseRenewalIntervalInSeconds: 10
    leaseExpirationDurationInSeconds: 30
  client:
    serviceUrl:
      defaultZone: http://localhost:8761/eureka/
  • 启用AdminServer

增加@EnableAdminServer,启用Spring Boot Admin
增加@EnableDiscoveryClient,启用服务注册与发现

@EnableDiscoveryClient
@EnableAdminServer
@SpringBootApplication
public class SpringBootAdminServerApplication {

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

运行截图

  • Applications

application

  • Journal

journal