Return to site
JAVA INTERVIEW QUESTION: What does @RequestMapping annotation do?
The @RequestMapping annotation is used to map web requests to Spring Controller methods.
·
You can map requests based upon HTTP methods like the GET and POST and various other parameters. For examples, if you are developing RESTful Web Service using Spring then you can use produces and consumes property along with media type annotation to indicate that this method is only used to produce or consumers JSON as shown below:
You can similarly create other handler methods to produce JSON or XML.