20

I am working in REST webservice. I was going through some blogs and there I saw for mapping of URL to a method, they used different annotations. Some places used @RequestMapping and some places used @Path. How does both differ?

Rocherlee
  • 2,536
  • 1
  • 20
  • 27
Rashmi
  • 271
  • 1
  • 2
  • 11

1 Answers1

30

It depends on the framework that creates the Web service

@RequestMapping is an annotation used in Spring framework https://spring.io/guides/gs/rest-service/

@Path is an annotation used in frameworks implementing JAX-RS API, such as Jersey https://jersey.java.net/documentation/latest/jaxrs-resources.html#d0e2001

If you want to know which one is better, this topic may help

Community
  • 1
  • 1
Rocherlee
  • 2,536
  • 1
  • 20
  • 27