Spring Boot Admin对Spring Boot监控

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接: https://blog.csdn.net/weixin_44716935/article/details/102759363

Spring Boot监控单体应用
Admin Client服务端
导入依赖
在这里插入图片描述
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客服端
导入依赖
在这里插入图片描述
启动类

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

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

在这里插入图片描述
在这里插入图片描述
参考文章

猜你喜欢

转载自blog.csdn.net/weixin_44716935/article/details/102759363