title: Spring MVC - The @Controller annotation does not get autodetected
body: <p>I am new in spring, therefore maybe my question is stupid! I am trying to add a controller to Spring's Petclinic example. However, the mappings in this controller do not work and I get 404 error. I added the same mapping to the other existing controllers and it works. I want to see what I am doing wrong. Here is my controller:</p>
  
  <pre><code>package org.springframework.samples.petclinic.web;
  
  import java.util.Map;
  import org.springframework.ui.Model;
  import org.springframework.web.bind.annotation.RequestMapping;
  import org.springframework.web.bind.annotation.RequestMethod;
  import org.springframework.web.bind.annotation.RequestParam;
  import org.springframework.stereotype.Controller;
  
  @Controller
  public class TwitterController {
  
      @RequestMapping(value = "/twitter/searchtweets", method = RequestMethod.GET)
          public String initFindForm(Map&lt;String, Object&gt; model) {
          ...
          return "twitter/searchtweets";
      }
  }
  </code></pre>
  
  <p>and here is the component scan definition in my MVC config file:</p>
  
  <pre><code>&lt;context:component-scan
          base-package="org.springframework.samples.petclinic.web"/&gt;
  </code></pre>
  
  <p>And:</p>
  
  <pre><code>    &lt;bean class="org.springframework.web.servlet.view.ContentNegotiatingViewResolver"&gt;
      &lt;property name="contentNegotiationManager" ref="cnManager"/&gt;
  
      &lt;property name="viewResolvers"&gt;
          &lt;list&gt;
               &lt;!-- Default viewClass: JSTL view (JSP with html output) --&gt;
              &lt;bean class="org.springframework.web.servlet.view.InternalResourceViewResolver"&gt;
                  &lt;!-- Example: a logical view name of 'vets' is mapped to '/WEB-INF/jsp/vets.jsp' --&gt;
                  &lt;property name="prefix" value="/WEB-INF/jsp/"/&gt;
                  &lt;property name="suffix" value=".jsp"/&gt;
              &lt;/bean&gt;
  
              &lt;!-- Used here for 'xml' and 'atom' views  --&gt;
              &lt;bean class="org.springframework.web.servlet.view.BeanNameViewResolver"/&gt;
          &lt;/list&gt;
      &lt;/property&gt;
  &lt;/bean&gt;
  
  &lt;!-- Simple strategy: only path extension is taken into account --&gt;
  &lt;bean id="cnManager" class="org.springframework.web.accept.ContentNegotiationManagerFactoryBean"&gt;
      &lt;property name="favorPathExtension" value="true"/&gt;
      &lt;property name="ignoreAcceptHeader" value="true"/&gt;
      &lt;property name="defaultContentType" value="text/html"/&gt;
  
      &lt;property name="mediaTypes"&gt;
          &lt;map&gt;
              &lt;entry key="html" value="text/html" /&gt;
              &lt;entry key="xml" value="application/xml" /&gt;
              &lt;entry key="atom" value="application/atom+xml" /&gt;
          &lt;/map&gt;
      &lt;/property&gt;
  &lt;/bean&gt;
  </code></pre>
  
  <p>The address: <code>localhost:8081/petclinic/twitter/searchtweets.html</code> returns 404 Error. It's worth mentioning that the jsp file here in: <code>webapp/WEB_INF/jsp/twitter/searchtweets.jsp</code></p>
  
  <p>Am I missing something?</p>