Quick-Start Guide
Rest Client Generator is a Java annotation processor for the generation of Java rest clients. It saves you from writing the http requests by hand.
To create a definition of your api client, declare an interface like this:
@RestClient(value = "client-one", path = "/api/v1/users")
interface UserService {
@GET
List getUsers();
@GET("{id}")
List getUser(@Path Long id);
}
At compile time RestClientGenerator will generate an implementation of this interface. The generated implementation uses plain Java method invocations for mapping between source and target objects, i.e. no reflection is involved.
The purpose of the annotations in the code above is the following:
@RestClient
Identify this interface to be available as a REST Client@GET
define the http method@Path
replace the{id}
with the parameterLong id
Clients Implemented
Choose you favorite client to setup the configurations
Clients |
---|
Spring WebClient |
Spring RestTemplate |