title: Configurable port in $resouce with spring-boot
body: <p><strong>Prerequisites</strong></p>
  
  <ul>
  <li>spring-boot 1.3.1.RELEASE</li>
  <li>TypeScript 1.8.9</li>
  <li>AngularJs 1.5.3</li>
  <li>Zuul</li>
  </ul>
  
  <p>I have an api gateway which hides a set of microservices.
  This api gateway uses zuul to map Urls to the different microservices.</p>
  
  <pre><code>zuul:
    routes:
  service1:
    path: /service1/**
    serviceId: FIRST-MICROSERVICE
  service2:
    path: /service2/**
    serviceId: SECOND-MICROSERVICE
  service3:
    path: /service3/**
    serviceId: THIRD-MICROSERVICE
  </code></pre>
  
  <p><strong>Question</strong></p>
  
  <p>I want to be able to start the api gateway on different ports with spring-boot like this:</p>
  
  <pre><code>java -jar -Dserver.port=8081 myspringbootapplication.jar
  </code></pre>
  
  <p>The host should always be the host from which the angularjs application was delivered. 
  The problem is that the port depends on the port spring-boot startet the tomcat server.
  At the moment <code><a href="http://localhost:9001" rel="nofollow">http://localhost:9001</a></code> is hardcoded.</p>
  
  <pre><code>    .factory('app.core.services.myApiResource', ['$resource', '$http',
          ($resource:ng.resource.IResourceService, $http:ng.IHttpService):ng.resource.IResourceClass&lt;ng.resource.IResource&lt;any&gt;&gt; =&gt; {
              var apiRoot : ng.resource.IResourceClass&lt;ng.resource.IResource&lt;any&gt;&gt;
                  = $resource('http://localhost:9001/service1/myentity/search/:finderName');
              return apiRoot;
          }
      ])
  </code></pre>
  
  <p>In bootstrap.yml the default port is 9001</p>
  
  <pre><code># Default ports
  server.port: 9001
  </code></pre>
  
  <p>Is there a way to set the port value in angularjs $resource to spring-boot server.port value?</p>