推荐使用okhttp.
<dependency>
<groupId>io.github.openfeign</groupId>
<artifactId>feign-okhttp</artifactId>
</dependency>
在yml文件中配置:
feign:
httpclient:
enabled: false
okhttp:
enabled: true
代码:
其中name随意给.url要给正确
@FeignClient(name = "wanwang", url = "http://panda.www.net.cn")
public interface KafkaDataTransmission {
@PostMapping("/cgi-bin/check.cgi")
String authenticationData(@RequestParam Map map);
测试代码:
@RequestMapping("/test")
public Result test() {
Map map = new HashMap(16);
map.put("area_domain", "teapic.com");
String a = kafkaDataTransmission.authenticationData(map);
log.info("返回数据:{}", a);
return Result.create().success(localeMessageUtil.getMessage("success"));
}
使用FeignClient注解,进行远程http第三方调用
最新推荐文章于 2024-03-04 15:48:56 发布