Bird
0
0

What does the @RequestMapping annotation do in Spring Boot?

easy📝 Conceptual Q11 of 15
Spring Boot - Request and Response Handling
What does the @RequestMapping annotation do in Spring Boot?
AIt styles the HTML page returned by the controller.
BIt creates a new database connection automatically.
CIt links a URL path and HTTP method to a specific method in a controller.
DIt schedules background tasks to run periodically.
Step-by-Step Solution
Solution:
  1. Step 1: Understand the purpose of @RequestMapping

    @RequestMapping is used to connect web requests to controller methods in Spring Boot.
  2. Step 2: Identify what it links

    It links both the URL path and the HTTP method (GET, POST, etc.) to the method that should handle the request.
  3. Final Answer:

    It links a URL path and HTTP method to a specific method in a controller. -> Option C
  4. Quick Check:

    @RequestMapping links URL and method [OK]
Quick Trick: Remember: @RequestMapping connects URL + HTTP method to code [OK]
Common Mistakes:
  • Thinking @RequestMapping styles HTML output
  • Confusing it with database or scheduling annotations
  • Assuming it only maps URL without HTTP method

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Spring Boot Quizzes