title: Rest Controller not recognizing GET request in Spring Boot App
body: <p>I am trying to implement simple demo MVC app with Spring Boot but I get 404 error while executing the application. The uri is `<a href="http://localhost:8080/" rel="noreferrer">http://localhost:8080/</a>' which is to display all the rows in a table called circle.</p>
  
  <ul>
  <li>Spring Boot  : 1.3.3.RELEASE</li>
  <li>Java Version : 1.8.0_65</li>
  <li>Database     : Apache Derby 10.12.1.1</li>
  </ul>
  
  <p>Maven Java Project:</p>
  
  <p><a href="https://i.stack.imgur.com/p5VFom.png" rel="noreferrer"><img src="https://i.stack.imgur.com/p5VFom.png" alt="Maven Java Project Structure"></a></p>
  
  <p><strong>Application.java</strong></p>
  
  <pre><code>package com.nomad.dubbed.app;
  
  import org.springframework.boot.SpringApplication;
  import org.springframework.boot.autoconfigure.SpringBootApplication;
  
  @SpringBootApplication
  public class Application  {
  
      public static void main(String[] args){
          SpringApplication.run(Application.class, args);
      }
  
  }
  </code></pre>
  
  <p><strong>CircleController.java</strong></p>
  
  <pre><code>package com.nomad.dubbed.controller;
  
  import java.util.List;
  
  import org.springframework.beans.factory.annotation.Autowired;
  import org.springframework.web.bind.annotation.RequestMapping;
  import org.springframework.web.bind.annotation.RequestMethod;
  import org.springframework.web.bind.annotation.RestController;
  
  import com.nomad.dubbed.dao.CircleService;
  import com.nomad.dubbed.model.Circle;
  
  @RestController
  @RequestMapping("/")
  public class CircleController {
      @Autowired
      private CircleService circleService;
  
      @RequestMapping(method=RequestMethod.GET)
      public List&lt;Circle&gt; getAll() {
          return circleService.getAll();
      }
  
  }
  </code></pre>
  
  <p><strong>CircleRepository.java</strong></p>
  
  <pre><code>package com.nomad.dubbed.dao;
  
  import org.springframework.data.jpa.repository.JpaRepository;
  import org.springframework.stereotype.Repository;
  
  import com.nomad.dubbed.model.Circle;
  
  @Repository
  public interface CircleRepository extends JpaRepository&lt;Circle, Integer&gt; {
  
  }
  </code></pre>
  
  <p><strong>CircleService.java</strong></p>
  
  <pre><code>package com.nomad.dubbed.dao;
  
  import java.util.List;
  
  import org.springframework.beans.factory.annotation.Autowired;
  import org.springframework.stereotype.Service;
  import org.springframework.transaction.annotation.Propagation;
  import org.springframework.transaction.annotation.Transactional;
  
  import com.nomad.dubbed.model.Circle;
  
  @Service
  public class CircleService {
      @Autowired
      private CircleRepository circleRepository;
  
      @Transactional(propagation=Propagation.REQUIRED)
      public List&lt;Circle&gt; getAll(){
          return circleRepository.findAll();
      }
  
  }
  </code></pre>
  
  <p><strong>Circle.java</strong></p>
  
  <pre><code>package com.nomad.dubbed.model;
  
  import javax.persistence.Entity;
  import javax.persistence.GeneratedValue;
  import javax.persistence.GenerationType;
  import javax.persistence.Id;
  import javax.persistence.Table;
  
  @Entity
  @Table(name="circle")
  public class Circle {
      @Id
      @GeneratedValue(strategy=GenerationType.IDENTITY)
      private int id;
      private String name;
  
      public Circle(int id, String name) {
          super();
          this.id = id;
          this.name = name;
      }
  
      public int getId() {
          return id;
      }
      public void setId(int id) {
          this.id = id;
      }
      public String getName() {
          return name;
      }
      public void setName(String name) {
          this.name = name;
      }
  
  }
  </code></pre>
  
  <p><strong>application.properties</strong></p>
  
  <pre><code>spring.datasource.url=jdbc:derby://localhost:1527/db
  spring.datasource.driverClassName=org.apache.derby.jdbc.ClientDriver
  
  logging.level.org.springframework.web:DEBUG
  logging.level.org.hibernate:DEBUG
  </code></pre>
  
  <p><strong>pom.xml</strong></p>
  
  <pre><code>&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;groupId&gt;com.nomad.dubbed&lt;/groupId&gt;
    &lt;artifactId&gt;spring-boot-mvc&lt;/artifactId&gt;
    &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
  
  
      &lt;properties&gt;
          &lt;derby-client.version&gt;10.11.1.1&lt;/derby-client.version&gt;
      &lt;/properties&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;1.3.3.RELEASE&lt;/version&gt;
          &lt;relativePath /&gt;
      &lt;/parent&gt;
      &lt;dependencies&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter&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-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-remote-shell&lt;/artifactId&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;dependency&gt;
              &lt;groupId&gt;org.apache.derby&lt;/groupId&gt;
              &lt;artifactId&gt;derbyclient&lt;/artifactId&gt;
              &lt;version&gt;${derby-client.version}&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;junit&lt;/groupId&gt;
              &lt;artifactId&gt;junit&lt;/artifactId&gt;
              &lt;scope&gt;test&lt;/scope&gt;
          &lt;/dependency&gt;
      &lt;/dependencies&gt;
      &lt;build&gt;
          &lt;finalName&gt;spring-boot-mvc&lt;/finalName&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>Database is up and running, there are 5 rows in the table circle:</p>
  
  <p><a href="https://i.stack.imgur.com/av6fZm.png" rel="noreferrer"><img src="https://i.stack.imgur.com/av6fZm.png" alt="enter image description here"></a></p>
  
  <p>The default uri (/beans, /health..) works fine but the implemented controller is not recognized. There is no error of such displayed in the console, below is the dump of logs printed in console after I send the request.</p>
  
  <pre><code>2016-05-03 14:17:26.594 DEBUG 659 --- [nio-8080-exec-3] o.s.web.servlet.DispatcherServlet        : DispatcherServlet with name 'dispatcherServlet' processing GET request for [/]
  2016-05-03 14:17:26.596 DEBUG 659 --- [nio-8080-exec-3] s.w.s.m.m.a.RequestMappingHandlerMapping : Looking up handler method for path /
  2016-05-03 14:17:26.596 DEBUG 659 --- [nio-8080-exec-3] s.w.s.m.m.a.RequestMappingHandlerMapping : Did not find handler method for [/]
  2016-05-03 14:17:26.597 DEBUG 659 --- [nio-8080-exec-3] o.s.w.s.handler.SimpleUrlHandlerMapping  : Matching patterns for request [/] are [/**]
  2016-05-03 14:17:26.597 DEBUG 659 --- [nio-8080-exec-3] o.s.w.s.handler.SimpleUrlHandlerMapping  : URI Template variables for request [/] are {}
  2016-05-03 14:17:26.597 DEBUG 659 --- [nio-8080-exec-3] o.s.w.s.handler.SimpleUrlHandlerMapping  : Mapping [/] to HandlerExecutionChain with handler [ResourceHttpRequestHandler [locations=[ServletContext resource [/], class path resource [META-INF/resources/], class path resource [resources/], class path resource [static/], class path resource [public/]], resolvers=[org.springframework.web.servlet.resource.PathResourceResolver@6c13019c]]] and 1 interceptor
  2016-05-03 14:17:26.597 DEBUG 659 --- [nio-8080-exec-3] o.s.web.servlet.DispatcherServlet        : Last-Modified value for [/] is: -1
  2016-05-03 14:17:26.597 DEBUG 659 --- [nio-8080-exec-3] o.s.web.servlet.DispatcherServlet        : Null ModelAndView returned to DispatcherServlet with name 'dispatcherServlet': assuming HandlerAdapter completed request handling
  2016-05-03 14:17:26.597 DEBUG 659 --- [nio-8080-exec-3] o.s.web.servlet.DispatcherServlet        : Successfully completed request
  2016-05-03 14:17:26.597 DEBUG 659 --- [nio-8080-exec-3] o.s.web.servlet.DispatcherServlet        : DispatcherServlet with name 'dispatcherServlet' processing GET request for [/error]
  2016-05-03 14:17:26.600 DEBUG 659 --- [nio-8080-exec-3] s.w.s.m.m.a.RequestMappingHandlerMapping : Looking up handler method for path /error
  2016-05-03 14:17:26.600 DEBUG 659 --- [nio-8080-exec-3] s.w.s.m.m.a.RequestMappingHandlerMapping : Returning handler method [public org.springframework.web.servlet.ModelAndView org.springframework.boot.autoconfigure.web.BasicErrorController.errorHtml(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)]
  2016-05-03 14:17:26.600 DEBUG 659 --- [nio-8080-exec-3] o.s.web.servlet.DispatcherServlet        : Last-Modified value for [/error] is: -1
  2016-05-03 14:17:26.601 DEBUG 659 --- [nio-8080-exec-3] o.s.w.s.v.ContentNegotiatingViewResolver : Requested media types are [text/html, text/html;q=0.8] based on Accept header types and producible media types [text/html])
  2016-05-03 14:17:26.601 DEBUG 659 --- [nio-8080-exec-3] o.s.w.s.v.ContentNegotiatingViewResolver : Returning [org.springframework.boot.autoconfigure.web.ErrorMvcAutoConfiguration$SpelView@2f5f8d71] based on requested media type 'text/html'
  2016-05-03 14:17:26.601 DEBUG 659 --- [nio-8080-exec-3] o.s.web.servlet.DispatcherServlet        : Rendering view [org.springframework.boot.autoconfigure.web.ErrorMvcAutoConfiguration$SpelView@2f5f8d71] in DispatcherServlet with name 'dispatcherServlet'
  2016-05-03 14:17:26.601 DEBUG 659 --- [nio-8080-exec-3] o.s.web.servlet.DispatcherServlet        : Successfully completed request 
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/H6bbAm.png" rel="noreferrer"><img src="https://i.stack.imgur.com/H6bbAm.png" alt="Rest App Browser"></a></p>