title: Spring Boot REST API not reachable in GCP
body: <p>I am deploying the Spring Boot Rest API in Google Cloud Platform. The Rest API is running fine in my local while running the application as Spring boot application.  But the same REST API URL is not recognized while deploying in GCP.</p>
  
  <p><strong>Project Structure:</strong>
  <a href="https://i.stack.imgur.com/mP7Su.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/mP7Su.png" alt="Project structure"></a></p>
  
  <p><strong>app.yaml:</strong></p>
  
  <pre><code>runtime: java
  env: flex
  runtime_config:
    jdk: openjdk8
  
  handlers:
    - url: /.*
      script: this field is required, but ignored
  </code></pre>
  
  <p><strong>GreetingController.java</strong></p>
  
  <pre><code>package com.designdreamers.rest.controller;
  
  import org.springframework.web.bind.annotation.RequestMapping;
  import org.springframework.web.bind.annotation.RequestParam;
  import org.springframework.web.bind.annotation.RestController;
  import com.designdreamers.rest.vo.Greeting;
  
  @RestController
  public class GreetingController {
  
      private int idValue;
  
      @RequestMapping(value="/greet")
      public Greeting greeting(@RequestParam(value="content", defaultValue = "Hello World!!")String content){
  
          Greeting greeting=new Greeting();
          greeting.setId(idValue++);
          greeting.setContent(content);
          return greeting;
      }
  }
  </code></pre>
  
  <p><strong>Application.java</strong></p>
  
  <pre><code>package com.designdreamers.rest.main;
  
  import org.springframework.boot.SpringApplication;
  import org.springframework.boot.autoconfigure.SpringBootApplication;
  import org.springframework.context.annotation.ComponentScan;
  
  
  @SpringBootApplication
  @ComponentScan(basePackages = "com.designdreamers.rest.controller")
  public class Application {
  
      public static void main(String args[]){
          SpringApplication.run(Application.class,args);
      }
  }
  </code></pre>
  
  <p>Below is the REST API response that I get on running the application as Spring boot application in local.</p>
  
  <p><strong>URL :</strong><a href="http://localhost:8080/greet" rel="nofollow noreferrer">http://localhost:8080/greet</a></p>
  
  <pre><code>{"id":1,"content":"Hello World!!"}
  </code></pre>
  
  <p>I deployed the same application in GCP and on hitting the REST API URI, below is the error that we get.</p>
  
  <p><strong>URI:</strong> <a href="http://helloworld-001.appspot.com/greet" rel="nofollow noreferrer">http://helloworld-001.appspot.com/greet</a></p>
  
  <pre><code>Error: Not Found
  The requested URL /greet was not found on this server.
  </code></pre>
  
  <p>A helping hand on identifying the issue would be very helpful.</p>