spring_reference/V. Spring Boot Actuator/40.1. Customizing endpoints.md

16 lines
753 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

### 40.1. 自定义端点
使用Spring属性可以自定义端点。你可以设置端点是否开启enabled是否敏感sensitive甚至它的id。例如下面的application.properties改变了敏感性和beans端点的id也启用了shutdown。
```java
endpoints.beans.id=springbeans
endpoints.beans.sensitive=false
endpoints.shutdown.enabled=true
```
**注**:前缀'endpoints + . + name'被用来唯一的标识被配置的端点。
默认情况下除了shutdown外的所有端点都是启用的。如果希望指定选择端点的启用你可以使用endpoints.enabled属性。例如下面的配置禁用了除info外的所有端点
```java
endpoints.enabled=false
endpoints.info.enabled=true
```