title: How to fix 'HTTP-404' error, during GET request in REST web service using spring boot
body: <p>My sample spring boot REST web service gives 404 error, and I am not sure what went wrong</p>
  
  <pre><code>package com.in28minutes.springboot.studentservices;
  @SpringBootApplication
  public class StudentServicesApplication {
  
  public static void main(String[] args) {
      SpringApplication.run(StudentServicesApplication.class, args);
  }
  
  }
  
  package com.in28minutes.springboot.controller;
  @RestController
  public class StudentController {
  
  @Autowired
  private StudentService studentService;
  
  @GetMapping("/students/{studentId}/courses")
  public List&lt;Course&gt; retrieveCoursesForStudent(@PathVariable String 
      studentId) {
      return studentService.retrieveCourses(studentId);
  }
  
  @GetMapping("/students/{studentId}/courses/{courseId}")
  public Course retrieveDetailsForCourse(@PathVariable String studentId,
          @PathVariable String courseId) {
      return studentService.retrieveCourse(studentId, courseId);
  }
  
  }
  </code></pre>
  
  <p>My Request  from POSTMan REST request sender: 
      <a href="http://localhost:8080/students/stu1/courses/course1" rel="nofollow noreferrer">http://localhost:8080/students/stu1/courses/course1</a></p>
  
  <p>pom.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;project xmlns="http://maven.apache.org/POM/4.0.0" 
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
  http://maven.apache.org/xsd/maven-4.0.0.xsd"&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.1.1.RELEASE&lt;/version&gt;
      &lt;relativePath/&gt; &lt;!-- lookup parent from repository --&gt;
   &lt;/parent&gt;
   &lt;groupId&gt;com.in28minutes.springboot&lt;/groupId&gt;
   &lt;artifactId&gt;student-services&lt;/artifactId&gt;
   &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
   &lt;name&gt;student-services&lt;/name&gt;
   &lt;description&gt;Demo project for Spring Boot&lt;/description&gt;
  
   &lt;properties&gt;
      &lt;java.version&gt;1.8&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-actuator&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.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-devtools&lt;/artifactId&gt;
          &lt;scope&gt;runtime&lt;/scope&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;/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;/plugin&gt;
      &lt;/plugins&gt;
     &lt;/build&gt;
  
  &lt;/project&gt;
  </code></pre>
  
  <p>Response:</p>
  
  <p>{
      "timestamp": "2018-12-28T02:48:00.185+0000",
      "status": 404,
      "error": "Not Found",
      "message": "No message available",
      "path": "/students/stu1/courses/course1"
  }</p>