Bird
0
0

You want to customize the health endpoint to show "UP" only if both database and cache are reachable. Which approach correctly implements this logic?

hard📝 Application Q15 of 15
Spring Boot - Actuator
You want to customize the health endpoint to show "UP" only if both database and cache are reachable. Which approach correctly implements this logic?
AUse two separate HealthIndicator classes without combining results
BReturn Health.up() always and add details for database and cache status
CReturn Health.down() always and ignore individual checks
DReturn Health.up() if both checks pass; else Health.down() with details for each failure
Step-by-Step Solution
Solution:
  1. Step 1: Understand combined health logic

    The health status should be UP only if both database and cache are reachable; otherwise DOWN.
  2. Step 2: Implement conditional return with details

    Return Health.up() if both pass; else return Health.down() and include details explaining which failed.
  3. Final Answer:

    Return Health.up() if both checks pass; else Health.down() with details for each failure -> Option D
  4. Quick Check:

    Combined checks control status UP or DOWN with details [OK]
Quick Trick: Return UP only if all checks pass; else DOWN with failure details [OK]
Common Mistakes:
  • Returning UP regardless of failures
  • Ignoring combined status logic
  • Splitting checks without combining results

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Spring Boot Quizzes