Bird
0
0

Given this custom endpoint class, what will be the HTTP response body when accessing the endpoint?

medium📝 component behavior Q13 of 15
Spring Boot - Actuator
Given this custom endpoint class, what will be the HTTP response body when accessing the endpoint?
@Endpoint(id = "status")
public class StatusEndpoint {
  @ReadOperation
  public String getStatus() {
    return "UP";
  }
}
A"DOWN"
B404 Not Found
C"UP"
D500 Internal Server Error
Step-by-Step Solution
Solution:
  1. Step 1: Analyze the custom endpoint class

    The class is annotated with @Endpoint(id = "status") and has a method with @ReadOperation returning "UP".
  2. Step 2: Understand the HTTP response from the read operation

    Accessing the actuator endpoint with id "status" triggers the getStatus() method, returning the string "UP" as the response body.
  3. Final Answer:

    "UP" -> Option C
  4. Quick Check:

    Read operation returns "UP" [OK]
Quick Trick: ReadOperation returns method result as HTTP response body [OK]
Common Mistakes:
  • Expecting 404 if endpoint is defined correctly
  • Confusing return value with HTTP status code
  • Assuming method returns JSON object instead of string

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Spring Boot Quizzes