文章
第 03 章:OpenFeign 声明式调用
2026-07-23 04:09:00 阅读: 0
OpenFeign 声明式调用
一、定义接口
java
@FeignClient(name = "user-service")
public interface UserClient {
@GetMapping("/users/{id}")
User getById(@PathVariable Long id);
}
二、配置
yaml
feign:
client:
config:
default:
connect-timeout: 5000
read-timeout: 10000
