REST Web服务中@Path和@Requestmapping之间的区别

Ras*_*hmi 13 rest web-services path

我在REST webservice工作.我正在浏览一些博客,在那里我看到了URL到方法的映射,他们使用了不同的注释.使用了一些地方@RequestMapping和一些地方使用@Path.两者有何不同?

Roc*_*lee 22

它取决于创建Web服务的框架

@RequestMapping是Spring框架中使用的注释 https://spring.io/guides/gs/rest-service/

@Path是实现JAX-RS API的框架中使用的注释,例如Jersey https://jersey.java.net/documentation/latest/jaxrs-resources.html#d0e2001

如果您想知道哪一个更好,这个主题可能会有所帮助