Spring Boot 版本: 1.5.20
一、Spring Boot Admin Server
1、在pom.xml中增加
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency> <dependency>
<groupId>de.codecentric</groupId>
<artifactId>spring-boot-admin-server</artifactId>
<version>1.5.6</version>
</dependency>
<dependency>
<groupId>de.codecentric</groupId>
<artifactId>spring-boot-admin-server-ui</artifactId>
<version>1.5.6</version>
</dependency>
2、增加注解
修改端口为8000
3、启动
二、Spring Boot Client
1、pom.xml 增加
<dependency>
<groupId>de.codecentric</groupId>
<artifactId>spring-boot-admin-starter-client</artifactId>
<version>1.5.6</version>
</dependency> <dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId> </dependency>
在application.yml配置文件中配置
spring:
boot:
admin:
url: http://localhost:8000
http://localhost:8000为Spring Boot Admin的地址
2、再次打开http://localhost:8000
可以发现有一个Client处于Up状态了。
参考:http://www.ityouknow.com/springboot/2018/02/11/spring-boot-admin.html