the proxy design pattern is a super useful one in @Java.
The idea behind a proxy is to make it more transparent to work with remote resources. They're all over the place in @Java and enterprise Java, in particular. I'm going to look at some of my favorite examples in this thread
Spring Integration supports messaging gateways through proxies: inject a reference to Cafe, invoke that method and a Message<T> with the payload Order gets sent on the orders MessageChannel (and then to anywhere ya like)
@SpringCloud has a popular integration with #OpenFeign. Invoke methods on an injected instance of ApiClient to send (and receive) HTTP payloads to the configured HTTP service.
@SpringData supports the concept of repositories, itself also a design pattern, using proxies. Here, clients can invoke methods on CustomerRepository to reactively persist, update, or read data in a SQL/NoSQL database.
@SpringCloud also supports some of the popular @Square OSS projects, including #Retrofit, which is a bit like #OpenFeign, except that it also supports asynchronous/reactive HTTP requests/responses:
And of course, we musn't forget the now decades old support in core Spring for remote service invocation using protocols like Hessian, Burlap, HTTP-Invoker, RMI, etc. Clients can inject a reference to CabBookingService to invoke methods on the remote endpoint.
Share this Scrolly Tale with your friends.
A Scrolly Tale is a new way to read Twitter threads with a more visually immersive experience.
Discover more beautiful Scrolly Tales like this.