spring-boot-admin 2.0小试牛刀

本文主要展示下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

wallboard.png

wallboard 实例详情

details.png

applications

applications.png

journal

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

转载于:https://my.oschina.net/go4it/blog/1816348

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值