Spring Boot 2.X combat tutorial (19) end

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跟踪信息(默认情况下,最后100HTTP请求 - 响应交换)。

info

显示任意应用信息。

integrationgraph

显示Spring Integration图。

loggers

显示和修改应用程序中记录器的配置。

liquibase

显示已应用的任何Liquibase数据库迁移。

metrics

显示当前应用程序的指标信息。

mappings

显示所有@RequestMapping路径的整理列表。

scheduledtasks

显示应用程序中的计划任务。

sessions

允许从Spring Session支持的会话存储中检索和删除用户会话。使用Spring Session对响应式Web应用程序的支持时不可用。

shutdown

允许应用程序正常关闭。

没有

threaddump

执行线程转储。

如果您的应用程序是Web应用程序(Spring MVCSpring WebFluxJersey),则可以使用以下附加端点:

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 = envbeans

 

If in doubt, watch the video: https://ke.qq.com/course/428845

 

Guess you like

Origin www.cnblogs.com/daqiang123/p/11270975.html