I have a service definition using Spring annotations. Example ( source ):
@RequestMapping(value = "/ex/foos/{id}", method = GET)
@ResponseBody
public String getFoosBySimplePathWithPathVariable(
@PathVariable("id") long id) {
return "Get a specific Foo with id=" + id;
}
The question is whether Spring (or another library) can automatically create a remote implementation (client) of the same API without having to manually enter the paths, method type, parameter names, etc. (e.g. when using RestTemplate)?
An example of using such a client:
FooClient fooClient = new FooClient("http://localhost:8080");
String foo = fooClient.getFoosBySimplePathWithPathVariable(3l);
How can I get such a “generated” implementation of such a client?
source
share