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

编程入门 行业动态 更新时间:2024-10-27 23:21:05
本文介绍了REST Web服务中@Path和@Requestmapping之间的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

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

解决方案

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

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

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

如果您想知道哪个更好,请本主题可能有帮助

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?

解决方案

It depends on the framework that creates the Web service

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

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

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

更多推荐

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

本文发布于:2023-10-07 17:50:34,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1470085.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:区别   Web   REST   Requestmapping   Path

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!