Performance: Health endpoint customization
This affects the server response time and network payload size when clients request health status.
management.endpoint.health.show-details=when-authorized
# Only shows detailed info to authorized users, otherwise minimal status
management.endpoint.health.show-details=always
# Exposes all health details including database, disk space, and custom checks
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Full detailed health response | N/A | N/A | N/A | [X] Bad |
| Minimal health response with caching | N/A | N/A | N/A | [OK] Good |
HealthIndicator, which requires overriding health().public class MyHealth implements HealthIndicator {
@Override
public Health health() {
return Health.up().withDetail("db", "reachable").build();
}
}Health.up() with a detail key "db" set to "reachable".public class CustomHealth implements HealthIndicator {
public Health health() {
return Health.down().withDetails("error", "Database unreachable").build();
}
}health() matches interface; @Override annotation is optional but recommended.withDetails() does not exist; correct method is withDetail() for adding one detail.Pass the test and this pattern moves unknown