title: No mapping found for HTTP request with URI in DispatcherServlet after adding a crudrepositority
body: <p>My Spring server is working right (simple site showing a googlemap). But when I want to add a crudrepository (and of course a @Entity) the application doesn't find the same URI that before was working. How can I fix this?</p>
  
  <p><strong>A piece of the system output:</strong></p>
  
  <blockquote>
    <p>16:32:29.737 [690530332@qtp-1564826387-0] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Finished creating instance of bean 'org.springframework.web.servlet.support.SessionFlashMapManager'
    16:32:29.737 [690530332@qtp-1564826387-0] DEBUG o.s.web.servlet.DispatcherServlet - Unable to locate FlashMapManager with name 'flashMapManager': using default [org.springframework.web.servlet.support.SessionFlashMapManager@186fc102]
    16:32:29.738 [690530332@qtp-1564826387-0] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Returning cached instance of singleton bean 'serverProperties'
    16:32:29.739 [690530332@qtp-1564826387-0] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Returning cached instance of singleton bean 'managementServerProperties'
    16:32:29.739 [690530332@qtp-1564826387-0] DEBUG o.s.c.e.PropertySourcesPropertyResolver - Searching for key 'spring.liveBeansView.mbeanDomain' in [servletConfigInitParams]
    16:32:29.739 [690530332@qtp-1564826387-0] DEBUG o.s.c.e.PropertySourcesPropertyResolver - Searching for key 'spring.liveBeansView.mbeanDomain' in [servletContextInitParams]
    16:32:29.739 [690530332@qtp-1564826387-0] DEBUG o.s.c.e.PropertySourcesPropertyResolver - Found key 'spring.liveBeansView.mbeanDomain' in [servletContextInitParams] with type [String] and value 'dev'
    16:32:29.751 [690530332@qtp-1564826387-0] DEBUG o.s.web.servlet.DispatcherServlet - Published WebApplicationContext of servlet 'sample' as ServletContext attribute with name [org.springframework.web.servlet.FrameworkServlet.CONTEXT.sample]
    16:32:29.751 [690530332@qtp-1564826387-0] INFO  o.s.web.servlet.DispatcherServlet - FrameworkServlet 'sample': initialization completed in 7745 ms
    16:32:29.751 [690530332@qtp-1564826387-0] DEBUG o.s.web.servlet.DispatcherServlet - Servlet 'sample' configured successfully
    16:32:29.757 [690530332@qtp-1564826387-0] DEBUG o.s.web.servlet.DispatcherServlet - DispatcherServlet with name 'sample' processing GET request for [/mapa/hello]
    16:32:29.759 [690530332@qtp-1564826387-0] DEBUG o.s.w.s.m.m.a.RequestMappingHandlerMapping - Looking up handler method for path /hello
    16:32:29.761 [690530332@qtp-1564826387-0] DEBUG o.s.w.s.m.m.a.RequestMappingHandlerMapping - Did not find handler method for [/hello]
    16:32:29.761 [690530332@qtp-1564826387-0] DEBUG o.s.b.a.e.mvc.EndpointHandlerMapping - Looking up handler method for path /hello
    16:32:29.762 [690530332@qtp-1564826387-0] DEBUG o.s.b.a.e.mvc.EndpointHandlerMapping - Did not find handler method for [/hello]
    16:32:29.762 [690530332@qtp-1564826387-0] WARN  o.s.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/mapa/hello] in DispatcherServlet with name 'sample'
    16:32:29.772 [690530332@qtp-1564826387-0] DEBUG o.s.web.servlet.DispatcherServlet - Successfully completed request</p>
  </blockquote>
  
  <p><strong>Application.java</strong></p>
  
  <pre><code>@EnableAutoConfiguration
  @EntityScan(basePackageClasses=palmaslab.mapas.repository.PostoSaude.class)
  @EnableJpaRepositories(basePackageClasses       =palmaslab.mapas.repository.PostoSaudeRepository.class/*.PostoSaudeRepository.class*/)
  @EnableWebMvc
  @Configuration
  @ComponentScan(basePackages="palmaslab.mapas.controller")
  public class Application {
  
  @Bean
  public InternalResourceViewResolver viewResolver() {
      InternalResourceViewResolver resolver = new InternalResourceViewResolver();
      resolver.setPrefix("/WEB-INF/view/");
      resolver.setSuffix(".jsp");
      return resolver;
  }
  @Bean
  public MultipartConfigElement multipartConfigElement() {
      MultiPartConfigFactory factory = new MultiPartConfigFactory();
      factory.setMaxFileSize("256KB");
      factory.setMaxRequestSize("256KB");
      return factory.createMultipartConfig();
  }
  public static void main(String[] args) {
      SpringApplication.run(Application.class, args);
  }
  }
  </code></pre>
  
  <p><strong>MyController</strong></p>
  
  <pre><code>@Controller
      public class myController {
      @Autowired
  private PostoSaudeRepository PostosSaude;
  
  //get postos!!
  @RequestMapping("hello")
  public ModelAndView showMessage(
          @RequestParam(value = "name", required = false, defaultValue = "World") String name) {
      ModelAndView mv = new ModelAndView("mapa");
  //  mv.addObject("postossaude", PostosSaude.findAll());
      return mv;
  }}
  </code></pre>
  
  <p><strong>PostoSaudeRepository</strong></p>
  
  <pre><code>public interface PostoSaudeRepository extends CrudRepository&lt;PostoSaude,Long&gt; {
      public PostoSaude findById(long id);
  }
  </code></pre>
  
  <p><strong>PostoSaude (Entity)</strong></p>
  
  <pre><code>@Entity
  public class PostoSaude {
  @Id
  @GeneratedValue(strategy=GenerationType.AUTO)
  private long id;
  
  private String nome_posto_saude;
  private double latitude;
  private double longitude;
  private String endereco;
  private String barrio_ou_nome_municipio; //aqui se coloca o nome do municipio, por exemplo Caucaia, o String cidade nesse caso ficará vazio ""
  private String cidade;
  private String estado;
  private String pais;
  
  public PostoSaude()
  {}
  
  public PostoSaude(String nome_posto_saude, String endereco,String barrio_ou_nome_municipio,String cidade, String estado, String pais)
  {
      this.nome_posto_saude = nome_posto_saude;
      this.endereco = endereco;
      this.barrio_ou_nome_municipio = barrio_ou_nome_municipio;
      this.cidade = cidade;
      this.estado = estado;
      this.pais = pais;
  
  }
  
  public String getBarrio_ou_nome_municipio() {
      return barrio_ou_nome_municipio;
  }
  
  public void setBarrio_ou_nome_municipio(String barrio_ou_nome_municipio) {
      this.barrio_ou_nome_municipio = barrio_ou_nome_municipio;
  }
  
  public String getCidade() {
      return cidade;
  }
  
  public void setCidade(String cidade) {
      this.cidade = cidade;
  }
  
  public String getEstado() {
      return estado;
  }
  
  public void setEstado(String estado) {
      this.estado = estado;
  }
  
  public String getPais() {
      return pais;
  }
  
  public void setPais(String pais) {
      this.pais = pais;
  }
  
  public String getNome_posto_saude() {
      return nome_posto_saude;
  }
  
  public void setNome_posto_saude(String nome_posto_saude) {
      this.nome_posto_saude = nome_posto_saude;
  }
  
  public double getLatitude() {
      return latitude;
  }
  
  public void setLatitude(double d) {
      this.latitude = d;
  }
  
  public double getLongitude() {
      return longitude;
  }
  
  public void setLongitude(double d) {
      this.longitude = d;
  }
  
  public String getEndereco() {
      return endereco;
  }
  
  public void setEndereco(String endereco) {
      this.endereco = endereco;
  }
  
  public long getId() {
      return id;
  }
  @Override
  public int hashCode() {
      // Google Guava provides great utilities for hashing
      return Objects.hashCode(nome_posto_saude, endereco, cidade);
  }
  
  @Override
  public boolean equals(Object obj) {
      if (obj instanceof PostoSaude) {
          PostoSaude other = (PostoSaude) obj;
          // Google Guava provides great utilities for equals too!
          return Objects.equal(nome_posto_saude, other.nome_posto_saude)
                  &amp;&amp; Objects.equal(endereco, other.endereco)
                  &amp;&amp; cidade == other.cidade;
      } else {
          return false;
      }
  }
  }
  </code></pre>
  
  <p><strong>web.xml</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-        app_2_5.xsd"&gt;
  &lt;servlet&gt;
  &lt;servlet-name&gt;sample&lt;/servlet-name&gt;
  &lt;servlet-class&gt;
      org.springframework.web.servlet.DispatcherServlet
  &lt;/servlet-class&gt;
  &lt;init-param&gt;
    &lt;param-name&gt;contextClass&lt;/param-name&gt;
    &lt;param-value&gt; org.springframework.web.context.support.AnnotationConfigWebApplicationContext         &lt;/param-value&gt;
   &lt;/init-param&gt;
   &lt;init-param&gt;
    &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt;
    &lt;param-value&gt;palmaslab.mapas.config&lt;/param-value&gt;
   &lt;/init-param&gt;
   &lt;/servlet&gt;
  
  &lt;servlet-mapping&gt;
  &lt;servlet-name&gt;sample&lt;/servlet-name&gt;
  &lt;url-pattern&gt;/&lt;/url-pattern&gt;
  
   &lt;/servlet-mapping&gt;
  &lt;context-param&gt;  
  &lt;param-name&gt;spring.profiles.active&lt;/param-name&gt;  
  &lt;param-value&gt;dev&lt;/param-value&gt;  
  &lt;/context-param&gt;  
  &lt;context-param&gt;  
  &lt;param-name&gt;spring.profiles.default&lt;/param-name&gt;  
  &lt;param-value&gt;dev&lt;/param-value&gt;  
  &lt;/context-param&gt;
  &lt;context-param&gt;  
  &lt;param-name&gt;spring.liveBeansView.mbeanDomain&lt;/param-name&gt;  
  &lt;param-value&gt;dev&lt;/param-value&gt;  
  &lt;/context-param&gt;  
  &lt;/web-app&gt;
  </code></pre>