【问题标题】:netflix feign client - RequestMethod.POST submits empty json object to servicenetflix feign 客户端 - RequestMethod.POST 向服务提交空 json 对象
【发布时间】:2017-08-31 14:04:09
【问题描述】:

当我使用 netflix 客户端发送 POST 请求时,当它到达服务使用者时,json 属性是空白的。

下面是我的界面

@FeignClient(name = "NLPService",  configuration = FooConfiguration.class )
public interface NLPServiceConsumer  extends TempInterface {    
}


public interface TempInterface {

    @RequestMapping("/greeting")
    String greeting();

    @RequestMapping(method = RequestMethod.POST,value="/nlp",
            consumes="application/json",produces="application/json")
    NLPResponse identifyTags(NLPInputToBeTransformed nlpInputToBeTransformed);

    @RequestMapping(method = RequestMethod.GET,value="/nlpGetMethod",
            produces="application/json")
    NLPResponse identifyTagsTest();


}

方法 identifyTagsTest 有效,我能够成功获得响应。 该方法是没有输入的GET方法

当我尝试 POST 方法时,将对象作为参数传递,在端点服务实现中,对象属性为空。

有人遇到过这样的问题吗?我的配置有什么错误吗?

【问题讨论】:

    标签: spring-cloud spring-cloud-netflix spring-cloud-feign


    【解决方案1】:

    问题不在于 feign 客户端。在服务实现中

    在这个问题上花了将近一天的时间。 RestController 还必须指定@RequestBody(共享接口除外)

    can @FeignClient extend - and @RestController implement - a common, fully-annotated Interface?

    【讨论】:

    • 谢谢!节省了我的时间。
    猜你喜欢
    • 2017-03-07
    • 1970-01-01
    • 1970-01-01
    • 2016-12-25
    • 2014-10-08
    • 2013-11-16
    • 2013-11-29
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多