我正在使用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之间的区别
发布评论