I am very used to work with spring applications. While creating a webserver with spring boot I wanted to provide a client library for convenient access to the api endpoints.
Within this library I use Spring's RestTemplate
because I am used to it's api.
While creating this library I came over this:
private final RestTemplate restTemplate;
public HQConnection(RestTemplateBuilder restTemplateBuilder) {
restTemplate = restTemplateBuilder.build();
}
And as I was writing my tests to see the API class actually being used I was using @Autowire to inject this component - normal thing for me since I am used to Spring's DI.
But then I realized something. What about those android developers who don't work with the Spring Framework?
They have to actually instantiate the HQConnection
by their own. This will be a big hassle since they have to get Spring into their app (if this is even possible?) to have access to a RestTemplateBuilder
.
I was thinking "How can I make this API easy to use and hide the Spring detail?". I could not yet make up an answer and therefore asking for some guidance here.