actuator 配置端点检查
订单服务
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
management.endpoints.enabled-by-default=true
management.endpoints.web.base-path=/actuator
#management.endpoints.web.exposure.exclude 排除的端点
management.endpoints.web.exposure.include=*
management.endpoint.health.show-details=always
启动项目,发现有许多mapper注入,/actuator/env、/actuator/info、/actuator/health、actuator/beans等
[main] INFO o.s.b.a.e.web.EndpointLinksResolver 87 - Exposing 0 endpoint(s) beneath base path '/actuator'
访问http://127.0.0.1:9230/actuator/
Spring Boot Admin
Spring Boot Admin 是一个管理和监控Spring Boot 应用程序的开源软件,它针对spring-
boot的actuator接口进行UI美化封装
(1)创建yww-admin-server项目
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>de.codecentric</groupId>
<artifactId>spring-boot-admin-starter-server</artifactId>
</dependency>
<dependency>
<groupId>de.codecentric</groupId>
<artifactId>spring-boot-admin-starter-server-ui</artifactId>
</dependency>
spring.pplication.name=admin-server
server.port=9990
启动类@EnableAdminServer
(2)配置客户端
<dependency>
<groupId>de.codecentric</groupId>
<artifactId>spring-boot-admin-starter-client</artifactId>
<version>2.1.0</version>
</dependency>
spring.boot.admin.url=http://127.0.0.1:9990
网友评论