cloud-admin-ui(服务端)
pom.xml
<dependency>
<groupId>de.codecentric</groupId>
<artifactId>spring-boot-admin-starter-server</artifactId>
<version>2.1.6</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
application.yml
eureka:
client:
serviceUrl:
defaultZone: http://localhost:7800/eureka/
server:
port: 9998
#Actuator配置:暴露敏感路径,默认情况下,敏感路径并不暴露
management:
endpoints:
web:
exposure:
# 暴露xxx端点,如需暴露多个,用,分隔;如需暴露所有端点,用'*'
include: "*"
endpoint:
health:
# 是否展示健康检查详情
show-details: ALWAYS
# info信息会显示到SpringBootAdmin的server端,这里取的是pom文件中的数据
info:
version: @project.version@
groupId: @project.groupId@
artifactId: @project.artifactId@
CloudAdminUiApplication.java
@SpringBootApplication
@Configuration
@EnableAdminServer
@EnableEurekaClient
@EnableDiscoveryClient
public class CloudAdminUiApplication {
public static void main(String[] args) {
SpringApplication.run(CloudAdminUiApplication.class, args);
}
}
cloud-feign 客户端
pom.xml
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
application.yml
management:
endpoints:
web:
exposure:
include: '*'
endpoint:
health:
show-details: ALWAYS