title: How to deploy a wiremock service from a spring boot application to azure app services?
body: <p>I have a spring-boot application in which I start a wiremock server on localhost, port 80. When I run the application locally, I can access the wiremock server (on <a href="http://localhost:80" rel="nofollow noreferrer">http://localhost:80</a>). However, when the spring-boot application is deployed to app services in azure and started, the 80 port is already used, so the mock cannot start. </p>
  
  <p>The ideea is to have the application deployed and the mock started, so when I access the URL of the app service, to be able to access the mock. </p>
  
  <p>I have tried changing the port and I can see from the logs that the mock starts on other ports. However, when accessing the URL of the app service, it does not redirect to the mock. The spring-boot is not a web application, so it should not take the default port 80 and leave it unoccupied instead. I am new to azure app services and spring-boot, so any advice would be apreciated</p>
  
  <pre><code>public static void main(String[] args) {
          SpringApplication.run(MocksApplication.class, args);      
      }
  
      @Bean
      public static PropertySourcesPlaceholderConfigurer propertyConfigInDev() {
          return new PropertySourcesPlaceholderConfigurer();
      }   
  
      private void startMock() {
  
          File file = new File(classLoader.getResource("mock").getFile());
          String path = file.getAbsolutePath();
          mock= new WireMockServer((wireMockConfig().usingFilesUnderDirectory(path).port(80)));
          mock.start();
          logger.info("Starting mock on port " + mock.port() + " and bind addresss: " + mock.baseUrl());
  
      }
      @Override
      public void run(String... args) throws Exception {
          startMock();
  
      }
  </code></pre>