You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
> Tip — The return type is strongly typed: `ServiceClientResponse<CustomerCreateResponse>`.
278
-
> You can safely navigate `resp.getData().getCustomer()` without casting.
279
-
> Handle non-2xx via Spring exceptions (e.g., `HttpClientErrorException`) as usual.
245
+
> **Note — demo only:**
246
+
> The configuration above wires the generated client beans for quick local demos.
247
+
> In production, you should encapsulate `CustomerControllerApi` behind your own Adapter (see [âś… Using the Client in Another Microservice](#-using-the-client-in-another-microservice) below).
248
+
> This keeps generated code isolated and lets your services depend only on stable adapter interfaces.
280
249
281
250
---
282
251
@@ -441,6 +410,101 @@ This ensures:
441
410
442
411
---
443
412
413
+
## đź”— Using the Client in Another Microservice
414
+
415
+
When another microservice (e.g., `payment-service`) depends on `customer-service-client`, the recommended approach is to wrap the generated adapter behind a stable interface in your own project.
416
+
417
+
This keeps generated code fully encapsulated and exposes only a clean contract to the rest of your service.
418
+
419
+
---
420
+
421
+
### Example Structure in `payment-service`
422
+
423
+
```
424
+
com.example.payment.client.customer
425
+
├─ CustomerServiceClient.java (interface)
426
+
└─ CustomerServiceClientImpl.java (implementation using injected adapter)
0 commit comments