spring boot admin 实现对服务的监控
service端:项目依赖:<dependencies><dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-starter-eureka<
·
service端:
项目依赖:
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-eureka</artifactId>
</dependency>
<dependency>
<groupId>de.codecentric</groupId>
<artifactId>spring-boot-admin-server</artifactId>
<version>1.5.6</version>
</dependency>
<dependency>
<groupId>de.codecentric</groupId>
<artifactId>spring-boot-admin-server-ui</artifactId>
<version>1.5.6</version>
</dependency>
</dependencies>
配置文件:
server:
port: 8000
spring:
application:
name: admin-server
eureka:
instance:
leaseRenewalIntervalInSeconds: 10
client:
registryFetchIntervalSeconds: 5
serviceUrl:
defaultZone: ${EUREKA_SERVICE_URL:http://localhost:8761}/eureka/
management.security.enabled: false
启动类:
@EnableEurekaClient
@SpringBootApplication
@EnableAdminServer
public class SilkRoadEruekaApplication {
public static void main(String[] args) {
SpringApplication.run(SilkRoadEruekaApplication.class, args);
}
}
client端:
依赖:
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-eureka</artifactId>
</dependency>
<dependency>
<groupId>de.codecentric</groupId>
<artifactId>spring-boot-admin-starter-client</artifactId>
<version>1.5.7</version>
</dependency>
</dependencies>
启动类:
启动类不需要添加admin相关的注解
@EnableEurekaClient
@SpringBootApplication
public class SrDhTraApplication {
public static void main(String[] args) {
SpringApplication.run(SrDhTraApplication.class, args);
}
}
这样就可以用了:
详细使用方式: https://blog.csdn.net/hubo_88/article/details/80671192
更多推荐
已为社区贡献5条内容
所有评论(0)