装了 Actuator 默认暴露什么?include=* 危险在哪?heapdump 和 shutdown 为什么默认打不开?env 里的密码会不会明文?单独的管理端口有什么坑?这篇在 Spring Boot 4.0.8 上逐个端点实测。
GET /actuator → 200;links = ['health', 'health-path', 'self']
GET /actuator/health → 200 {"groups":["liveness","readiness"],"status":"UP"}
GET /actuator/info → 404 {"timestamp":"2026-10-20T02:51:39.612Z","status":404,"error":"Not Foun…
GET /actuator/env → 404 {"timestamp":"2026-10-20T02:51:39.620Z","status":404,"error":"Not Foun…
GET /actuator/metrics → 404 {"timestamp":"2026-10-20T02:51:39.625Z","status":404,"error":"Not Foun…
GET /actuator/beans → 404 {"timestamp":"2026-10-20T02:51:39.629Z","status":404,"error":"Not Foun…
GET /actuator/heapdump → 404 {"timestamp":"2026-10-20T02:51:39.635Z","status":404,"error":"Not Foun…只暴露 health,且不带组件明细;其他端点 404。
GET /actuator → 200;共 19 个链接(含 self);端点:['beans', 'conditions', 'configprops', 'configprops-prefix', 'env', 'env-toMatch', 'health', 'health-path', 'info', 'loggers', 'loggers-name', 'mappings', 'metrics', 'metrics-requiredMetricName', 'sbom', 'sbom-id', 'scheduledtasks', 'threaddump']
GET /actuator/env → 200,8 KB,17 ms
GET /actuator/beans → 200,99 KB,10 ms
GET /actuator/mappings → 200,19 KB,20 ms
GET /actuator/threaddump → 200,60 KB,16 ms
GET /actuator/configprops → 200,13 KB,57 ms
GET /actuator/loggers → 200,31 KB,7 ms
GET /actuator/conditions → 200,65 KB,6 ms
GET /actuator/heapdump → 404,0 KB,8 ms
POST /actuator/shutdown → 404 {"timestamp":"2026-10-20T02:51:41.679Z","status":404,"error":"Not Foun…
-- 额外加 management.endpoint.heapdump.access=unrestricted:
/actuator 里有 heapdump:True
GET /actuator/heapdump → 200,Content-Type application/octet-stream,32.2 MB,261 ms;请求里没有带任何认证信息
-- 暴露了但把访问权限关掉:management.endpoint.env.access=none、management.endpoint.shutdown.access=unrestricted
/actuator 里有 env:False;有 shutdown:True
GET /actuator/env → 404
POST /actuator/shutdown → 200 {"message":"Shutting down, bye..."}
shutdown 之后 3 秒,java 进程 已退出,退出码 0include=* 之后 19 个端点没有认证;heapdump、shutdown 还要把 access 设成 unrestricted,打开后同样没有认证。
默认(management.endpoint.env.show-values 不设):
app.name → 200,值 '******',来源 systemProperties
app.password → 200,值 '******',来源 systemProperties
app.token → 200,值 '******',来源 systemProperties
app.url → 200,值 '******',来源 systemProperties
management.endpoint.env.show-values=ALWAYS:
app.name → 200,值 'demo',来源 systemProperties
app.password → 200,值 'p@ssw0rd',来源 systemProperties
app.token → 200,值 'tok-123',来源 systemProperties
app.url → 200,值 'http://example.com',来源 systemProperties
management.endpoint.env.show-values=WHEN_AUTHORIZED(没有装 Spring Security):
app.name → 200,值 '******',来源 systemProperties
app.password → 200,值 '******',来源 systemProperties
app.token → 200,值 '******',来源 systemProperties
app.url → 200,值 '******',来源 systemProperties默认所有值脱敏;show-values=ALWAYS 全部明文;WHEN_AUTHORIZED 没有 Security 时仍脱敏。
management.server.port=9608:业务端口 GET /actuator/health → 404;管理端口 GET /fast → 404;管理端口 GET /actuator/health:业务端口可连接之后又过了 261 ms 才连得上管理端口(此前连接被拒绝 11 次),第一次响应 → 503 {"groups":["liveness","readiness"],"status":"DOWN"},2 秒后 → 200 {"groups":["liveness","readiness"],"status":"UP"}
management.endpoints.web.base-path=/ops:/actuator/health → 404;/ops/health → 200管理端口比业务端口晚开,刚开时 health 返回 503 DOWN;base-path 可以改。
没有 actuator:启动到端口可连接 中位 817 ms(范围 815~917);启动后常驻内存中位 168 MB 有 actuator(默认):启动到端口可连接 中位 1082 ms(范围 972~1203);启动后常驻内存中位 184 MB
装 actuator 启动多约 265 ms、内存多约 16 MB(量级参考);请求吞吐开销没有得到可信结果。