什么是Spring Boot Admin?

一个管理和监视Spring Boot的应用程序

设置 Spring Boot Admin Server

pom.xml

1
2
3
4
5
6
7
8
9
10
<dependency>
<groupId>de.codecentric</groupId>
<artifactId>spring-boot-admin-server</artifactId>
<version>1.5.2</version>
</dependency>
<dependency>
<groupId>de.codecentric</groupId>
<artifactId>spring-boot-admin-server-ui</artifactId>
<version>1.5.2</version>
</dependency>

Spring Boot启动类

1
2
3
4
5
6
7
8
@Configuration
@EnableAutoConfiguration
@EnableAdminServer
public class SpringBootAdminApplication {
public static void main(String[] args) {
SpringApplication.run(SpringBootAdminApplication.class, args);
}
}

application.yml

1
2
server:
port: 8888

这样Spring Boot Admin Server就设置好了

Spring Boot 客户端注册

pom.xml

1
2
3
4
5
<dependency>
<groupId>de.codecentric</groupId>
<artifactId>spring-boot-admin-starter-client</artifactId>
<version>1.5.2</version>
</dependency>

application.yml

1
2
3
4
# 需要注册到Spring Boot Admin Server的URL
spring.boot.admin.url: http://localhost:8080
# 是否安全校验
management.security.enabled: false

Server 和 client 启动


Spring Cloud就不整了,太多了
更多见 : http://codecentric.github.io/spring-boot-admin/1.5.2

.