Bird
0
0

Given this custom health indicator code, what will the health endpoint show?

medium📝 component behavior Q13 of 15
Spring Boot - Actuator
Given this custom health indicator code, what will the health endpoint show?
public class MyHealth implements HealthIndicator {
  @Override
  public Health health() {
    return Health.up().withDetail("db", "reachable").build();
  }
}
A{"status":"UP","details":{"db":"reachable"}}
B{"status":"DOWN","details":{"db":"reachable"}}
C{"status":"UP"}
D{"status":"DOWN"}
Step-by-Step Solution
Solution:
  1. Step 1: Analyze health() method return

    The method returns Health.up() with a detail key "db" set to "reachable".
  2. Step 2: Understand output format

    The health endpoint shows status "UP" and includes the details map with "db":"reachable".
  3. Final Answer:

    {"status":"UP","details":{"db":"reachable"}} -> Option A
  4. Quick Check:

    Health.up() with details = status UP plus details [OK]
Quick Trick: Health.up() withDetail adds details and sets status UP [OK]
Common Mistakes:
  • Confusing UP with DOWN status
  • Ignoring details in output
  • Assuming default status without details

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Spring Boot Quizzes