Why we need @RequestMapping and how to use that?

0 votes
asked May 3, 2017 in JAVA by anonymous
Hi All

  Why we need @RequestMapping and how to use that?

1 Answer

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