Which annotation is mainly used to handle HTTP GET requests in a Spring Boot application?

  • @GetMapping
  • @RequestMapping
  • @RequestMethod.GET
  • @HttpHandler.GET
The @GetMapping annotation is mainly used to handle HTTP GET requests in a Spring Boot application. It is a specialized annotation that maps HTTP GET requests to specific controller methods. While @RequestMapping is a more generic annotation used for various HTTP methods, @GetMapping specifically targets GET requests, making the code more readable and explicit. The other options are not valid Spring annotations.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *