本文主要展示下spring-boot-admin 2.0版本的新特性

server实例

maven

        <dependency>
            <groupId>de.codecentric</groupId>
            <artifactId>spring-boot-admin-starter-server</artifactId>
            <version>2.0.0</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-webflux</artifactId>
        </dependency>
        <dependency>
            <groupId>org.jolokia</groupId>
            <artifactId>jolokia-core</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
        </dependency>

配置

spring:
  application:
    name: spring-boot-admin-server
eureka:
  instance:
    preferIpAddress: true
    leaseRenewalIntervalInSeconds: 10
  client:
    registryFetchIntervalSeconds: 5
    serviceUrl:
      defaultZone: ${EUREKA_SERVICE_URL:http://localhost:8761}/eureka/

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

config

@Configuration
@EnableAutoConfiguration
@EnableAdminServer
public class AdminServerApplication {

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

client实例

maven

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

配置

spring:
  boot:
    admin:
      client:
        url: http://localhost:8080

这里配置admin server的地址

运行实例

wallboard

spring-boot-admin 2.0小试牛刀
wallboard.png

wallboard 实例详情

spring-boot-admin 2.0小试牛刀
details.png

applications

spring-boot-admin 2.0小试牛刀
applications.png

journal

spring-boot-admin 2.0小试牛刀
journal.png

小结

新版前端改用vue.js进行了重构,后端的话,使用event sourcing的原则进行了重构,支持spring5,移除了spring-cloud-starter依赖,另外使用WebClient替代了zuul等等,具体详见spring-boot-admin-changes-with-2-x

对于client端来说,目前还不能像1.x版本那样依靠Spring Cloud Discovery进行自动注册,目前需要使用spring-boot-admin-starter-client。

doc

相关文章:

  • 2021-10-24
  • 2021-06-09
  • 2021-05-05
  • 2021-07-03
  • 2021-11-08
  • 2021-05-21
  • 2022-01-21
猜你喜欢
  • 2021-07-16
  • 2021-11-08
  • 2021-10-02
  • 2021-11-05
  • 2021-07-07
相关资源
相似解决方案