Spring Boot Admin对Spring Boot监控

Spring Boot监控单体应用
Admin Client服务端
导入依赖
Spring Boot Admin对Spring Boot监控_第1张图片
HelloController

@RestController
public class HelloController {
    @GetMapping("/hello") //测试请求http://localhost:8081/hello
    public String hello(){
        return "hello";
    }
}

application.properties

##配置 Admin Server 的地址
spring.boot.admin.client.url=http://localhost:8080
##打开客户端 Actuator 的监控
management.endpoints.web.exposure.include=*
server.port=8081

Admin Server客服端
导入依赖
Spring Boot Admin对Spring Boot监控_第2张图片
启动类

@SpringBootApplication
@EnableAdminServer
public class AdminserverApplication {
    public static void main(String[] args) {
        SpringApplication.run(AdminserverApplication.class, args);
    }
}

开启二个idea窗口
开启客服端监控:http://localhost:8080
请求:http://localhost:8081/hello

Spring Boot Admin对Spring Boot监控_第3张图片
Spring Boot Admin对Spring Boot监控_第4张图片
参考文章

你可能感兴趣的:(Spring,Boot)