title: Spring MVC controller rejected (No URL paths identified)
body: <p>I have a strange problem with Spring MVC in a project that my bean is rejected with the following message:</p>
  
  <p>BeanNameUrlHandlerMapping:86 - Rejected bean name 'restfulController': no URL paths identified</p>
  
  <p>Here is the code for the Controller:</p>
  
  <pre><code>package com.jidarc.mongodb.mvc.controller;
  
      import org.apache.log4j.Logger;
      import org.springframework.stereotype.Controller;
      import org.springframework.web.bind.annotation.PathVariable;
  import org.springframework.web.bind.annotation.RequestMapping;
  import org.springframework.web.bind.annotation.ResponseBody;
  
  @Controller
  @RequestMapping("/restful")
  public class RestfulController {
  
      private static final Logger LOGGER = Logger
              .getLogger(RestfulController.class);
  
      public RestfulController() {
          LOGGER.debug("INITIALIZING THE RESTFUL CONTROLLER");
      }
  
      @RequestMapping("/{name}")
      @ResponseBody
      public String get(@PathVariable String name) {
          LOGGER.debug("Received a GET request");
  
          return "Hello from Spring MVC++++++++++!" + name;
      }
  }
  </code></pre>
  
  <p>The content of the web.xml:</p>
  
  <pre><code>&lt;!DOCTYPE web-app PUBLIC
   "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
   "http://java.sun.com/dtd/web-app_2_3.dtd" &gt;
  
  &lt;web-app&gt;
      &lt;display-name&gt;Jidarc MongoDB Admin Project&lt;/display-name&gt;
  
      &lt;servlet&gt;
          &lt;servlet-name&gt;restful&lt;/servlet-name&gt;
          &lt;servlet-class&gt;org.springframework.web.servlet.DispatcherServlet&lt;/servlet-class&gt;
          &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
      &lt;/servlet&gt;
  
      &lt;servlet-mapping&gt;
          &lt;servlet-name&gt;restful&lt;/servlet-name&gt;
          &lt;url-pattern&gt;/restful&lt;/url-pattern&gt;
      &lt;/servlet-mapping&gt;
  
  &lt;/web-app&gt;
  </code></pre>
  
  <p>And the content of restful-servlet.xml:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;beans xmlns="http://www.springframework.org/schema/beans"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns:p="http://www.springframework.org/schema/p"
      xmlns:context="http://www.springframework.org/schema/context"
      xmlns:mvc="http://www.springframework.org/schema/mvc"
      xsi:schemaLocation="
          http://www.springframework.org/schema/beans
          http://www.springframework.org/schema/beans/spring-beans.xsd
          http://www.springframework.org/schema/context
          http://www.springframework.org/schema/context/spring-context.xsd
          http://www.springframework.org/schema/mvc 
          http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd"&gt;
  
      &lt;mvc:annotation-driven /&gt;
      &lt;context:component-scan base-package="com.jidarc.mongodb.mvc.controller"/&gt;
  
  &lt;/beans&gt;
  </code></pre>
  
  <p>When I try to contact the URL defined in the controller, I always get a 404.</p>
  
  <p>Thank you!</p>