问题:
报错提示不支持POST请求
解决:
使用SpringCloud2.1以上版本提供的@SpringQueryMap注解标注在实体对象参数后解决
导入注解包路径 import org.springframework.cloud.openfeign.SpringQueryMap;
示例代码如下:
/**
* 轮播图服务
*
* @author zys
*/
@FeignClient(contextId = "remoteRotationService", value = ServiceNameConstants.BIZ_ROTATION, fallbackFactory = RemoteRotationFallbackFactory.class)
public interface RemoteRotationService {
/**
* 获取轮播图信息
*
* @param bizRotationEntity 请求参数实体
* @return 结果
*/
@RequestMapping(value = "/rotation/app/list",method = RequestMethod.GET,consumes = "application/json")
public R<List<BizRotationEntity>> appList(@SpringQueryMap BizRotationEntity bizRotationEntity, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
/**
* 获取轮播图详情
*
* @param id
* @param source
* @return
*/
@GetMapping("/rotation/app/get/{id}")
public R<BizRotationEntity> getRotationById(@PathVariable("id")long id ,@RequestHeader(SecurityConstants.LOGIN_USER)String source);
}
参考:
https://www.cnblogs.com/wwct/p/12379127.html