Bird
0
0

What will be the output when a GET request is made to a Spring Boot controller method annotated with @GetMapping("/hello") that returns "Hello World"?

medium📝 component behavior Q4 of 15
Spring Boot - Request and Response Handling
What will be the output when a GET request is made to a Spring Boot controller method annotated with @GetMapping("/hello") that returns "Hello World"?
AMethod Not Allowed
BHello World
C500 Internal Server Error
D404 Not Found
Step-by-Step Solution
Solution:
  1. Step 1: Understand @GetMapping behavior

    @GetMapping("/hello") maps GET requests to the method.
  2. Step 2: Check method return value

    The method returns "Hello World", so that is the response body.
  3. Final Answer:

    Hello World -> Option B
  4. Quick Check:

    @GetMapping returns method string response [OK]
Quick Trick: GET request returns method's string response [OK]
Common Mistakes:
  • Expecting 404 if mapping is correct
  • Confusing HTTP method types causing 405 error

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Spring Boot Quizzes