title: Why can't Postman find my Spring REST API?
body: <p>I created a very basic Spring Boot project with REST APIs. I tried connecting it to my Angular app but it was getting some CORS security error so I switched to Postman. I'm trying to test it using Postman but I keep receiving a 404 not found error on Postman. Why am I not able to connect to my backend and post to tester function?</p>
  <p><strong>controller</strong></p>
  <pre class="lang-java prettyprint-override"><code>package controllers;
  
  @RestController
  public class Handler {
      
      @PostMapping(&quot;/tester/{id}&quot;)
      public String tester(@PathVariable(value=&quot;id&quot;)long userid ){
          
          System.out.println(&quot;in tester&quot;);
          System.out.println(userid);
          
          return &quot;succeeded test&quot;;
      }
  }
  </code></pre>
  <p><strong>main</strong></p>
  <pre class="lang-java prettyprint-override"><code>package halloween.contest;
  
  @SpringBootApplication(exclude = {DataSourceAutoConfiguration.class,
          SecurityAutoConfiguration.class})
  public class ContestApplication {
  
      public static void main(String[] args) {
          SpringApplication.run(ContestApplication.class, args);
      }
  
  }
  </code></pre>
  <p><strong><code>application.properties</code></strong></p>
  <pre class="lang-properties prettyprint-override"><code>spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.security.SecurityAutoConfiguration
  
  spring.data.rest.base-path=/
  </code></pre>
  <p><strong><code>pom.xml</code></strong></p>
  <pre class="lang-xml prettyprint-override"><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
  &lt;project xmlns=&quot;http://maven.apache.org/POM/4.0.0&quot; xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;
      xsi:schemaLocation=&quot;http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd&quot;&gt;
      &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
      &lt;parent&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-starter-parent&lt;/artifactId&gt;
          &lt;version&gt;2.5.6&lt;/version&gt;
          &lt;relativePath/&gt; &lt;!-- lookup parent from repository --&gt;
      &lt;/parent&gt;
      &lt;groupId&gt;halloween&lt;/groupId&gt;
      &lt;artifactId&gt;contest&lt;/artifactId&gt;
      &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
      &lt;name&gt;contest&lt;/name&gt;
      &lt;description&gt;halloween picture contest&lt;/description&gt;
      &lt;properties&gt;
          &lt;java.version&gt;11&lt;/java.version&gt;
      &lt;/properties&gt;
      &lt;dependencies&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-data-rest&lt;/artifactId&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-security&lt;/artifactId&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-web&lt;/artifactId&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.projectlombok&lt;/groupId&gt;
              &lt;artifactId&gt;lombok&lt;/artifactId&gt;
              &lt;optional&gt;true&lt;/optional&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-test&lt;/artifactId&gt;
              &lt;scope&gt;test&lt;/scope&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.security&lt;/groupId&gt;
              &lt;artifactId&gt;spring-security-test&lt;/artifactId&gt;
              &lt;scope&gt;test&lt;/scope&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-data-jpa&lt;/artifactId&gt;
          &lt;/dependency&gt;
      &lt;/dependencies&gt;
  
      &lt;build&gt;
          &lt;plugins&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
                  &lt;artifactId&gt;spring-boot-maven-plugin&lt;/artifactId&gt;
                  &lt;configuration&gt;
                      &lt;excludes&gt;
                          &lt;exclude&gt;
                              &lt;groupId&gt;org.projectlombok&lt;/groupId&gt;
                              &lt;artifactId&gt;lombok&lt;/artifactId&gt;
                          &lt;/exclude&gt;
                      &lt;/excludes&gt;
                  &lt;/configuration&gt;
              &lt;/plugin&gt;
          &lt;/plugins&gt;
      &lt;/build&gt;
  
  &lt;/project&gt;
  </code></pre>
  <p><strong>console</strong></p>
  <pre class="lang-none prettyprint-override"><code>  .   ____          _            __ _ _
   /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
  ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
   \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
    '  |____| .__|_| |_|_| |_\__, | / / / /
   =========|_|==============|___/=/_/_/_/
   :: Spring Boot ::                (v2.5.6)
  
  2021-10-26 15:44:12.823  INFO 18760 --- [           main] halloween.contest.ContestApplication     : Starting ContestApplication using Java 1.8.0_144 on DESKTOP-VB80TS0 with PID 18760 (C:\Users\Sergio Rodríguez\Documents\Halloween\contest\target\classes started by Sergio Rodríguez in C:\Users\Sergio Rodríguez\Documents\Halloween\contest)
  2021-10-26 15:44:12.827  INFO 18760 --- [           main] halloween.contest.ContestApplication     : No active profile set, falling back to default profiles: default
  2021-10-26 15:44:16.013  INFO 18760 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 8080 (http)
  2021-10-26 15:44:16.043  INFO 18760 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
  2021-10-26 15:44:16.043  INFO 18760 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet engine: [Apache Tomcat/9.0.54]
  2021-10-26 15:44:16.310  INFO 18760 --- [           main] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
  2021-10-26 15:44:16.310  INFO 18760 --- [           main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 3372 ms
  2021-10-26 15:44:19.326  INFO 18760 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port(s): 8080 (http) with context path ''
  2021-10-26 15:44:19.342  INFO 18760 --- [           main] halloween.contest.ContestApplication     : Started ContestApplication in 7.201 seconds (JVM running for 7.946)
  2021-10-26 15:45:45.138  INFO 18760 --- [nio-8080-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring DispatcherServlet 'dispatcherServlet'
  2021-10-26 15:45:45.139  INFO 18760 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet        : Initializing Servlet 'dispatcherServlet'
  2021-10-26 15:45:45.157  INFO 18760 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet        : Completed initialization in 17 ms
  </code></pre>
  <p><strong>equivalent cURL command</strong></p>
  <pre class="lang-shell prettyprint-override"><code>curl --location --request POST 'localhost:8080/tester/69'
  </code></pre>
  <p><strong>Postman</strong></p>
  <p><a href="https://i.stack.imgur.com/rxjQV.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/rxjQV.jpg" alt="Postman request responding with 404" /></a></p>