springboot FeignClient 请求接收json

 
  
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 getList(@RequestBody MspdpdVo mspdpdVo) ;
}

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

你可能感兴趣的:(JAVA,spring,boot)