Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce proxy-based REST client similar to HttpInvokerProxyFactoryBean [SPR-12131] #16747

Closed
spring-projects-issues opened this issue Aug 28, 2014 · 6 comments
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) status: superseded An issue that has been superseded by another type: enhancement A general enhancement

Comments

@spring-projects-issues
Copy link
Collaborator

spring-projects-issues commented Aug 28, 2014

George Georgovassilis opened SPR-12131 and commented

This ticket proposes a new component that will work similarly to HttpInvokerProxyFactoryBean and allows binding a java interface to a remote REST/JSON service. Annotations on the interface and its methods would define the mapping of method invocations to concrete HTTP requests to the REST service.

The component would be a proxy factory which is given the mapping (possibly via a class name) and returns proxies which pass method invocations to the remote REST service.

For a possible implementation see https://github.com/ggeorgovassilis/spring-rest-invoker


Affects: 4.0.6, 4.3.3

Reference URL: https://groups.google.com/forum/#!topic/spring-framework-contrib/HTja1bE1TWY

Issue Links:

4 votes, 9 watchers

@spring-projects-issues
Copy link
Collaborator Author

George Georgovassilis commented

It's been a while now and there hasn't been any progress. Like I said back then, I have a running implementation which I'd happily adapt to Spring standards and conventions. Rossen, would you help me work on that?

@spring-projects-issues
Copy link
Collaborator Author

Rossen Stoyanchev commented

Thanks the ping George Georgovassilis. We have a few related tickets and clearly something needs to be done but we need to make up our minds. I will need a little more time to respond more coherently. In the mean time can elaborate on what work may be required to adapt https://github.com/ggeorgovassilis/spring-rest-invoker above and beyond code style and conventions?

@spring-projects-issues
Copy link
Collaborator Author

George Georgovassilis commented

Tests are flaky because they depend on recorded & replayed messages - I will have a look at how the other invokers are tested in Spring and work out a compatible solution. The *ProxyFactoryBeans I've seen extend UrlBasedRemoteAccessor - I need to understand the type hierarchy better; maybe the BaseRestInvokerProxyFactoryBean should extend HttpInvokerClientInterceptor, I'll need your help for sorting that out. Also, the returned objects seem to be instances of ProxyFactory instead of returning directly proxies - I'm unclear as to why and if that is necessary. Last not least, because of the dependency on MVC annotations, the REST exporter can't live in the web module but needs to move to the web-mvc module (or a separate module)

@spring-projects-issues
Copy link
Collaborator Author

spring-projects-issues commented Sep 26, 2016

Rossen Stoyanchev commented

While I think this ticket is a worthwhile idea still for the time being I'm moving it into the 5.x backlog. It is more important to focus on completing the work on the reactive WebClient and then consider this feature against both the RestTemplate and the WebClient.

This is not on the critical path to 5.0 IMO because using the RestTemplate by comparison doesn't require that much code. Also there are alternatives even today. For example the Netflix Feign client is flexible enough to support different annotations and the Spring Cloud team have done that already. In fact I am wondering George Georgovassilis if you considered or would consider using Feign? If nothing else it reduces what you would have to write and maintain.

There are also a few things I noticed while looking at your spring-rest-invoker. If we are to support #15682 which we are still considering then I'm not sure that it would make sense to use a syntax with multiple @RequestBody annotations on a method as shown in the examples. It seems to me the same could be achieved with a Map of objects serialized to JSON. Even if you don't care about re-using interfaces between client and server, consistent use on both sides semantically still matters from an API perspective.

@spring-projects-issues
Copy link
Collaborator Author

George Georgovassilis commented

Since I submitted the ticket, my implementation received a few community contributions and is now available on maven central: https://github.com/ggeorgovassilis/spring-rest-invoker

I still prefer it over the alternatives mentioned because of its fewer dependencies and tighter coupling to Spring semantics.

 

 

@rstoyanchev
Copy link
Contributor

Superseded by #28386

@rstoyanchev rstoyanchev removed this from the General Backlog milestone May 20, 2022
@rstoyanchev rstoyanchev added the status: superseded An issue that has been superseded by another label May 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) status: superseded An issue that has been superseded by another type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

3 participants