title: Spring MVC error: The resource identified by this request is only capable of generating responses
body: <p>When I invoke this URL in the browser:</p>
  
  <pre><code>http://localhost:8080/app/foo.json
  </code></pre>
  
  <p>Spring responds with 406 Status code in this error message:</p>
  
  <blockquote>
    <p>The resource identified by this request is only capable of generating responses with characteristics not acceptable according to the request "accept" headers ().</p>
  </blockquote>
  
  <p>However I have defined my content negotiating view resolver like this:</p>
  
  <pre><code>&lt;bean class="org.springframework.web.servlet.view.ContentNegotiatingViewResolver"&gt;
      &lt;property name="favorPathExtension" value="true" /&gt;
      &lt;property name="ignoreAcceptHeader" value="true" /&gt;
  
      &lt;property name="mediaTypes"&gt;
          &lt;map&gt;
              &lt;entry key="json" value="application/json"/&gt;
              &lt;entry key="html" value="text/html"/&gt;
          &lt;/map&gt;
      &lt;/property&gt;
  &lt;/bean&gt;
  </code></pre>
  
  <p>And my controller is defined like this:</p>
  
  <pre><code>@Controller
  @RequestMapping(value = "/foo")
  public class ToowootController {
  
      @RequestMapping(method = GET)
      @ResponseBody
      public FooDTO index() {
          // return fooDTO
      }
  
  }
  </code></pre>
  
  <p>Any ideas what am I doing wrong?</p>