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
参考文章