The OpenFeign service-call process#
flowchart TD
A["Business code calls
userClient.getById(1L)"] --> B["JDK dynamic proxy Proxy.invoke"]
B --> C["Feign InvocationHandler
MethodHandler"]
C --> D["Contract parses annotations
@GetMapping / @PathVariable"]
D --> E["RequestTemplate builds the HTTP request"]
E --> F["Parameter binding
Path / Query / Body / Header"]
F --> G["Service name resolution: user-service"]
G --> H["Service discovery: Nacos / Eureka"]
H --> I["LoadBalancer load balancing"]
I --> J["Select instance IP:PORT"]
J --> K["HTTP Client executor
OkHttp / Apache / JDK"]
K --> L["Send HTTP request GET /user/1"]
L --> M["Remote service: user-service"]
M --> N["Controller handles the request"]
N --> O["Return JSON"]
O --> P["Feign Decoder deserializes"]
P --> Q["JSON → UserDTO"]
Q --> R["Return to business code"]