title: What is Spring REST url of my controller?
body: <p>I building rest application from scratch and I just create basic rest controller and I want to try if it works.</p>
  
  <p>Here it is:</p>
  
  <pre><code>@RestController
  @RequestMapping("/api")
  public class MyController {
  
      @GetMapping("/test")
      public String poll(@RequestParam Long messageId) {
          return "ok";
      }
  }
  </code></pre>
  
  <p>I tried it in browser on this url:
  <a href="http://localhost:8080/api/test?messageId=61" rel="nofollow noreferrer">http://localhost:8080/api/test?messageId=61</a></p>
  
  <p>but I got error 404</p>
  
  <blockquote>
    <p>This application has no explicit mapping for /error, so you are seeing
    this as a fallback.</p>
    
    <p>Wed Apr 25 21:23:35 CEST 2018 There was an unexpected error (type=Not
    Found, status=404). No message available</p>
  </blockquote>
  
  <p>Can you tell me what is correct url for this rest controller? Thanks.</p>
  
  <p>EDIT 1:
  this is from log so port is also ok:</p>
  
  <pre><code>Tomcat started on port(s): 8080 (http) with context path ''
  </code></pre>
  
  <p>EDIT 2:</p>
  
  <pre><code>spring.datasource.url=jdbc:postgresql://localhost:5432/mydb
  spring.datasource.username=xxx
  spring.datasource.password=xxx
  spring.datasource.driver-class-name=org.postgresql.Driver
  spring.jpa.show-sql=true
  spring.jpa.hibernate.ddl-auto=create-drop
  </code></pre>