0 votes
asked in JAVA by
Hi All

  Why we need @RequestMapping and how to use that?

1 Answer

0 votes
answered by (8.2k points)

       Use the @RequestMapping annotation to annotate the function that should handle certain HTTP methods, URIs, or HTTP headers. This annotation is the key to the Spring REST support. You change the method parameter to handle other HTTP methods.
For example:
@RequestMapping(method=RequestMethod.GET, value="/emps", 
headers="Accept=application/xml, application/json")