title: Auto generate client for Spring Controller
body: <p>TL;DR: auto generate HTTP client for each REST Spring Controller to reuse in other services written with Spring.</p>
  
  <p>When working with multiple micro-services that are written with spring I find myself rewriting the client for each controller. Lets say I write a controller in service X:</p>
  
  <pre><code>@RestController
  public class SubscriptionController {
  
      @Autowired
      private SubscriptionService subscriptionService;
  
      @RequestMapping(value = "/subscription", method = RequestMethod.GET)
      public SubscriptionDTO getMySubscription() {
          return subscriptionService.getCurrentUserSubscription();
      }
  
  }
  </code></pre>
  
  <p>I will import the DTO in service Y, write HTTP request to the mapping defined in the other service, and write tests for it. </p>
  
  <pre><code>@Service
  public class SubscriptionApiService {
  
      @Autowired
      private HttpClient httpClinet;
  
      public SubscriptionDTO getMySubscription() {
          return httpClient.get("/subscription", SubscriptionDTO.class);
      }
  
  }
  </code></pre>
  
  <p>It's very a repetitive process, and I'm quite sure someone already wrote a library to automate this process. However I was unable to find anything like that. Any idea?</p>