Feign 是一种声明式、模板化的 HTTP 客户端(仅在 consumer 中使用)
1.server端(定义pojo与接口API)
注意:
1.get方式不能传递对象必须将参数进行拆分处理,因为feign默认使用的httpURLConnection进行consumer与propertie之间请求的处理
2.get方式必须使用@RequestParam注解
3.post方式传递对象时必须使用@RequestBody注解
4.请求的url可以随便写,只要不重复就好,因为这里的url应用于consumer与provider之间的内部通信
@RequestMapping("/item")
public interface ItemService {
//无参
@GetMapping("/list")
List<Item> findItemList();
//单个参数
@GetMap