19 . End
By executing endpoints, you can monitor and interact with the application. Spring Boot contains a number of built-in endpoint, allowing you to add your own endpoints.
You can enable or disable each endpoint. It controls whether to create its endpoint and bean exists in the application context.
Most applications select HTTP , which endpoint ID and prefix / actuator mapped to the URL of . For example, by default, Health endpoint is mapped to / Actuator / Health .
ID |
description |
Enabled by default |
auditevents |
Audit Event Information Disclosure current application. |
Yes |
beans |
All display applications Spring bean complete list. |
Yes |
caches |
Expose cache available. |
Yes |
conditions |
Display condition evaluated on the type and configuration and autoconfiguration reason they match or not match. |
Yes |
configprops |
Displays a list of all the finishing @ConfigurationProperties. |
Yes |
env |
Exposed Spring property ConfigurableEnvironment. |
Yes |
flyway |
Applied show any Flyway database migration. |
Yes |
health |
Health information display applications. |
Yes |
httptrace |
显示HTTP跟踪信息(默认情况下,最后100个HTTP请求 - 响应交换)。 |
是 |
info |
显示任意应用信息。 |
是 |
integrationgraph |
显示Spring Integration图。 |
是 |
loggers |
显示和修改应用程序中记录器的配置。 |
是 |
liquibase |
显示已应用的任何Liquibase数据库迁移。 |
是 |
metrics |
显示当前应用程序的“指标”信息。 |
是 |
mappings |
显示所有@RequestMapping路径的整理列表。 |
是 |
scheduledtasks |
显示应用程序中的计划任务。 |
是 |
sessions |
允许从Spring Session支持的会话存储中检索和删除用户会话。使用Spring Session对响应式Web应用程序的支持时不可用。 |
是 |
shutdown |
允许应用程序正常关闭。 |
没有 |
threaddump |
执行线程转储。 |
是 |
如果您的应用程序是Web应用程序(Spring MVC,Spring WebFlux或Jersey),则可以使用以下附加端点:
ID |
描述 |
默认情况下启用 |
heapdump |
返回hprof堆转储文件。 |
是 |
jolokia |
通过HTTP公开JMX bean(当Jolokia在类路径上时,不适用于WebFlux)。 |
是 |
logfile |
返回日志文件的内容(如果已设置logging.file或logging.path属性)。支持使用HTTP Range标头检索部分日志文件的内容。 |
是 |
prometheus |
以可以由Prometheus服务器抓取的格式公开指标。 |
是 |
19.1启用端点
默认情况下,启用除shutdown外的所有端点。要配置端点的启用,请使用其management.endpoint.<id>.enabled属性。以下示例启用shutdown端点:
management.endpoint.shutdown.enabled = true
19.2公开端点
由于端点可能包含敏感信息,因此应仔细考虑何时公开它们。
要更改端点暴露,使用下面的特定技术include和 exclude特性:
This include attribute lists the disclosed endpoint ID . The exclude attribute lists should not be disclosed endpoint ID . The exclude property takes precedence over the include property.
* It can be used to select all endpoints.
For example, through HTTP public in addition to env and beans all but the endpoint, use the following attributes:
management.endpoints.web.exposure.include = *
management.endpoints.web.exposure.exclude = env,beans
If in doubt, watch the video: https://ke.qq.com/course/428845