如果不需要 head参数,就不用加 @RequestHeader。
在做服务调用时,一般不会用到 url属性。my.url 是配置的值,后面的: 是默认值。
示例如下:
@FeignClient(name = "myFeignService",
url = "${my.url:http://ip:端口/}")
public interface MyFeignService {
@PostMapping(value = "具体的url路径")
@ResponseBody
MyResponse post(@RequestBody MyBody myBody,
@RequestHeader(name = "headParam1", required = true) String headParam1);
}
或者是:
@RequestMapping(value = "/v1/xx/xxx", method = RequestMethod.POST,
headers = {"userName={userName}", "userId={userId}" }
)
Response getUser(@RequestParam("userName") String userName,
@RequestParam("userId") String userId);
在做服务调用时,一般不会用到 url属性。my.url 是配置的值,后面的: 是默认值。
示例如下:
@FeignClient(name = "myFeignService",
url = "${my.url:http://ip:端口/}")
public interface MyFeignService {
@GetMapping(value = "具体的url路径")
@ResponseBody
MyResponse get(@RequestParam (value = "param1") String param1,
@RequestParam (value = "param2") String param2);
}
https://cloud.tencent.com/developer/article/2000153