# 50. 端点

执行器端点（endpoints）可用于监控应用及与应用进行交互，Spring Boot包含很多内置的端点，你也可以添加自己的。例如，`health`端点提供了应用的基本健康信息。 可以单独[启用或禁用](https://docs.spring.io/spring-boot/docs/2.0.0.RELEASE/reference/htmlsingle/#production-ready-endpoints-enabling-endpoints)每个端点。这决定了端点是否已经创建并且在应用上下文里存在它的bean。[通过JMX或者HTTP暴露的](https://docs.spring.io/spring-boot/docs/2.0.0.RELEASE/reference/htmlsingle/#production-ready-endpoints-enabling-endpoints)端点可以被远程访问。大部分应用选择HTTP监控，端点的ID连同前缀`/actuator`映射到一个URL。例如，`health`端点默认映射到`/actuator/health`。

下面的端点都是可用的：

| ID               | 描述                                                                | 是否默认启用 |
| ---------------- | ----------------------------------------------------------------- | ------ |
| `auditevents`    | 为当前应用暴露审计事件的信息                                                    | Yes    |
| `beans`          | 显示一个应用中所有Spring Bean的完整列表                                         | Yes    |
| `conditions`     | 展示依据配置和自动配置类评估的条件，以及它们匹配或者不匹配的原因                                  | Yes    |
| `configprops`    | 显示一个所有`@ConfigurationProperties`的集合列表                             | Yes    |
| `env`            | 暴露来自Spring `ConfigurableEnvironment`的属性                           | Yes    |
| `flyway`         | 显示数据库迁移路径，如果有的话                                                   | Yes    |
| `health`         | 展示应用健康信息                                                          | Yes    |
| `httptrace`      | 显示HTTP跟踪信息（默认的，最后的100个HTTP请求-响应交换）                                | Yes    |
| `info`           | 显示任意的应用信息                                                         | Yes    |
| `loggers`        | 显示和修改应用中的记录器的配置                                                   | Yes    |
| `liquibase`      | 展示任何Liquibase数据库迁移路径，如果有的话                                        | Yes    |
| `metrics`        | 展示当前应用的'metrics'信息                                                | Yes    |
| `mappings`       | 显示一个所有`@RequestMapping`路径的集合列表                                    | Yes    |
| `scheduledtasks` | 显示应用里的计划任务                                                        | Yes    |
| `sessions`       | 允许从Spring Session的会话存储，检索和删除用户会话。当为响应式网络应用使用Spring Session支持时，不可用 | Yes    |
| `shutdown`       | 允许应用以优雅的方式关闭                                                      | No     |
| `threaddump`     | 执行线程转储                                                            | Yes    |

如果你的应用是一个网络应用（Spring MVC、Spring WebFlux或者Jersey），你可以使用以下额外的端点：

| ID           | 描述                                                                            | 是否默认启用 |
| ------------ | ----------------------------------------------------------------------------- | ------ |
| `heapdump`   | 返回一个GZip压缩的`hprof`堆转储文件                                                       | Yes    |
| `jolokia`    | 通过HTTP暴露JMX bean（当Jolokia在类路径上，对WebFlux不可用）                                   | Yes    |
| `logfile`    | 返回日志文件内容（如果设置了`logging.file`或`logging.path`属性），支持使用HTTP `Range`头接收日志文件内容的部分信息 | Yes    |
| `prometheus` | 用一种可以被Prometheus服务器下载的格式暴露度量指标                                                | Yes    |

请参考单独的API文档（[HTML](https://docs.spring.io/spring-boot/docs/2.0.0.RELEASE/actuator-api//html)或者[PDF](https://docs.spring.io/spring-boot/docs/2.0.0.RELEASE/actuator-api//pdf/spring-boot-actuator-web-api.pdf)），学习更多有关执行器端点和它们的请求与响应的格式。


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://jack80342.gitbook.io/spring-boot/v.-spring-boot-actuator/50.-endpoints.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
