springboot FeignClient 请求接收json

来源:互联网 发布:易语言编程系统全书 编辑:程序博客网 时间:2024/05/29 19:41
package com.gy.api;import com.gy.vo.ResultList;import com.gy.vo.ResultObject;import com.gy.vo.msp.MspddVo;import com.gy.vo.msp.MspdpdVo;import org.springframework.cloud.netflix.feign.FeignClient;import org.springframework.http.MediaType;import org.springframework.web.bind.annotation.RequestBody;import org.springframework.web.bind.annotation.RequestMapping;import org.springframework.web.bind.annotation.RequestMethod;import org.springframework.web.bind.annotation.RequestParam;@FeignClient(url = "${kx.service.url}",name="mspurl")public interface MspDpdApi {    @RequestMapping(value="/pdpd/list",method= RequestMethod.POST,consumes = MediaType.APPLICATION_JSON_VALUE)    public ResultList<MspdpdVo> getList(@RequestBody MspdpdVo mspdpdVo) ;}

规范:声明
consumes = MediaType.APPLICATION_JSON_VALUE
consumes跟produces不同,
consumes是请求端数据类型,一般跟RequestBody一起使用
produces是响应数据类型--ResultList<MspdpdVo>