RequestMapping and @GetMapping
@RequestMapping
- Can handle all HTTP methods (GET, POST, PUT, DELETE)
- Syntax:
@RequestMapping(value="/path", method=RequestMethod.GET)
@GetMapping
- Handles GET requests only
- Syntax:
@GetMapping("/path") - Simpler and cleaner for GET requests
Example: