Spring Boot Admin 使用的坑
这几天公司需要部署SpringBootAdmin监控,用来时刻关注微服务的状态 按照官网的操作非常简单: 1. 添加依赖到pom.xml <dependency> <groupId>de.codecentric</groupId> <artifactId>spring-boot-admin-server</artifactId> <version>${springboot.admin.version}</version> </dependency> <dependency> <groupId>de.codecentric</groupId> <artifactId>spring-boot-admin-server-ui</artifactId> <version>${springboot.admin.version}</version> </dependency> 2. 启动类Application添加注解@EnableAdminServer 3. 如果本身是用SpringCloud管理,比如我们用的是Eureka管理服务的,所以添加@EnableEurekaClient,让AdminServer作为一个微服务被集中治理,而每个其它的微服务都可以被访问到监控状态。 4. 但这样不会监控微服务的服务本身,所以需要在有注解@EnableEurekaServer的服务上