因为缺失POST GET注解而导致Failed processing arguments of org.jboss.resteasy.spi.metadata.ResourceLocator

面向服务的架构现在如火如荼,国内常用的当属阿里巴巴开源的dubbo,但我觉得后起之秀的spring cloud很可能弯道超车。闲话说了一些,下面入主题,出问题rest服务接口

    @Path("queryList")
    //@POST---漏掉@POST注解就会出错
    @Override

下面来分析下POST注解:

@Target({ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
@HttpMethod(HttpMethod.POST)
@Documented
public @interface POST {
}

这个里面又涉及到一个主要的注解HttpMethod:

/**
 * Associates the name of a HTTP method with an annotation. A Java method annotated
 * with a runtime annotation that is itself annotated with this annotation will
 * be used to handle HTTP requests of the indicated HTTP method
. It is an error
 * for a method to be annotated with more than one annotation that is annotated
 * with {@code HttpMethod}.
 *
 * @author Paul Sandoz
 * @author Marc Hadley
 * @see GET
 * @see POST
 * @see PUT
 * @see DELETE
 * @see HEAD
 * @since 1.0
 */
@Target({ElementType.ANNOTATION_TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface HttpMethod


该接口doc说明概括下来就是:

HttpMethod(或者扩展注解接口)注解的方法会被用来处理相应HTTP请求方法(POST/GET/PUT等)请求,如果漏掉这个注解,那么相应的方法就没有了这个能力!!



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值