Why we need @RequestMapping and how to use that?

0 votes
asked May 3 in JAVA by anonymous
Hi All

  Why we need @RequestMapping and how to use that?

1 Answer

0 votes
answered May 10 by admin (8,115 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")