Skip to content

Spring MVC REST: Provide interface definition model for generating HTTP client interface proxies wrapping RestTemplates [SPR-6261] #10929

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

Closed
spring-projects-issues opened this issue Oct 22, 2009 · 3 comments
Assignees
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) status: duplicate A duplicate of another issue type: enhancement A general enhancement

Comments

@spring-projects-issues
Copy link
Collaborator

spring-projects-issues commented Oct 22, 2009

Alex Antonov opened SPR-6261 and commented

Provide interface definition model for generating HTTP client interface proxies wrapping RestTemplates.

Code implementation to follow.


Affects: 3.0 RC1

Issue Links:

3 votes, 12 watchers

@spring-projects-issues
Copy link
Collaborator Author

spring-projects-issues commented Oct 22, 2009

Alex Antonov commented

As an example of what an interface would look like:

public interface ProtobufHotelSearchService {
    @ServiceRequest(name="hotel.id", method= HttpInvocationHandler.RequestMethod.GET, pattern = "/${id}")
    public HotelProtos.Hotel findHotelById(@ParamName("id") Long id);

    @ServiceRequest(name="hotel.search", method= HttpInvocationHandler.RequestMethod.GET)
    public HotelProtos.HotelList findHotels(@ParamName("search") String search,
                                            @ParamName("page") int page,
                                            @ParamName("size") int size);

    @ServiceRequest(name="hotel.update")
    public void updateHotels(HotelProtos.Hotel h);
}

@ServiceRequest annotation would indicate to the invocation handler what HTTP call you are going to make.
@ParamName is similar to @RequestParam & @PathVariable from MVC

Those then get processed by the invocation handler to determine what the URL should look like, what HTTP method (GET, PUT, etc) should be executed, etc... After all that is figured out, a delegate call to RestTemplate can be made to actually process the request.

@spring-projects-issues
Copy link
Collaborator Author

Marten Deinum commented

I guess this is what Netflix Feign already provides on the plain Spring MVC annotations.

@spring-projects-issues
Copy link
Collaborator Author

spring-projects-issues commented Sep 22, 2016

Rossen Stoyanchev commented

Yes indeed it is the same although a much older ticket. I will resolve it as superseded by the likes of #16827 and #16747 that are currently under consideration.

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: duplicate A duplicate of another issue type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

2 participants