首页 > 其他分享 >Spring Boot Admin 搭建

Spring Boot Admin 搭建

时间:2023-02-22 14:33:50浏览次数:30  
标签:暴露 CloudAdminUiApplication Admin Spring boot server pom Boot spring


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


标签:暴露,CloudAdminUiApplication,Admin,Spring,boot,server,pom,Boot,spring
From: https://blog.51cto.com/u_12553406/6078962

相关文章