title: Rejected bean name 'propertyConfigurer': no URL paths identified
body: <p>I am playing with spring (btw I used to know spring when it uses configuration instead of annotation). </p>
  
  <h2>pom.xml</h2>
  
  <pre><code>&lt;properties&gt;
      &lt;spring.version&gt;3.0.5.RELEASE&lt;/spring.version&gt;
      &lt;hibernate.version&gt;3.6.10.Final&lt;/hibernate.version&gt;
      &lt;junit.version&gt;4.11&lt;/junit.version&gt;
      &lt;jdk.version&gt;1.6&lt;/jdk.version&gt;
  &lt;/properties&gt;
  </code></pre>
  
  <h2>web.xml</h2>
  
  <pre><code>&lt;web-app 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"
        version="2.5"&gt;    
  
  &lt;display-name&gt;Demo Web Application&lt;/display-name&gt;
  
  &lt;servlet&gt;
      &lt;servlet-name&gt;mvc-dispatcher&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;mvc-dispatcher&lt;/servlet-name&gt;
      &lt;url-pattern&gt;/&lt;/url-pattern&gt;
  &lt;/servlet-mapping&gt;
  
  &lt;context-param&gt;
      &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt;
      &lt;param-value&gt;/WEB-INF/mvc-dispatcher-servlet.xml&lt;/param-value&gt;
  &lt;/context-param&gt;
  
  &lt;welcome-file-list&gt;
      &lt;welcome-file&gt;index.html&lt;/welcome-file&gt;
  &lt;/welcome-file-list&gt;
  &lt;/web-app&gt;
  </code></pre>
  
  <h2>mvc-dispatcher-servlet.xml</h2>
  
  <pre><code>&lt;beans xmlns="http://www.springframework.org/schema/beans"
  xmlns:context="http://www.springframework.org/schema/context"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
  xmlns:tx="http://www.springframework.org/schema/tx"
  xmlns:mvc="http://www.springframework.org/schema/mvc"
  xsi:schemaLocation="
      http://www.springframework.org/schema/beans     
      http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
      http://www.springframework.org/schema/context 
      http://www.springframework.org/schema/context/spring-context-3.0.xsd
      http://www.springframework.org/schema/tx
      http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
      http://www.springframework.org/schema/mvc 
      http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd"&gt;
  
  &lt;context:component-scan base-package="com.company.controller" /&gt;
  &lt;context:component-scan base-package="com.company.service" /&gt;
  &lt;context:component-scan base-package="com.company.dao" /&gt;
  &lt;context:component-scan base-package="com.company.hibernate" /&gt;
  
  &lt;bean id="propertyConfigurer"
  class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"
      p:location="/WEB-INF/jdbc.properties" /&gt;
  
  &lt;bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"
      destroy-method="close" p:driverClassName="${jdbc.driverClassName}"
      p:url="${jdbc.databaseurl}" p:username="${jdbc.username}" p:password="${jdbc.password}" /&gt;
  
  &lt;bean id="sessionFactory"
      class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"&gt;
      &lt;property name="dataSource" ref="dataSource" /&gt;
      &lt;property name="configLocation"&gt;
          &lt;value&gt;/WEB-INF/hibernate.cfg.xml&lt;/value&gt;
      &lt;/property&gt;
      &lt;property name="configurationClass"&gt;
          &lt;value&gt;org.hibernate.cfg.AnnotationConfiguration&lt;/value&gt;
      &lt;/property&gt;
      &lt;property name="hibernateProperties"&gt;
          &lt;props&gt;
              &lt;prop key="hibernate.dialect"&gt;${jdbc.dialect}&lt;/prop&gt;
              &lt;prop key="hibernate.show_sql"&gt;true&lt;/prop&gt;
          &lt;/props&gt;
      &lt;/property&gt;
  &lt;/bean&gt;
  
  &lt;bean id="transactionManager"
      class="org.springframework.orm.hibernate3.HibernateTransactionManager"&gt;
      &lt;property name="sessionFactory" ref="sessionFactory" /&gt;
  &lt;/bean&gt;
  
  &lt;bean
      class="org.springframework.web.servlet.view.InternalResourceViewResolver"&gt;
      &lt;property name="prefix"&gt;
          &lt;value&gt;/WEB-INF/pages/&lt;/value&gt;
      &lt;/property&gt;
      &lt;property name="suffix"&gt;
          &lt;value&gt;.jsp&lt;/value&gt;
      &lt;/property&gt;
  &lt;/bean&gt;
  
  &lt;/beans&gt;
  </code></pre>
  
  <h2>jdbc.properties</h2>
  
  <pre><code>jdbc.driverClassName= com.mysql.jdbc.Driver
  jdbc.dialect=org.hibernate.dialect.MySQLDialect
  jdbc.databaseurl=jdbc:mysql://127.7.195.2:3306/tomcat2
  jdbc.username=xxxx
  jdbc.password=yyyy
  </code></pre>
  
  <h2>hibernate.cfg.xml</h2>
  
  <pre><code>&lt;?xml version='1.0' encoding='utf-8'?&gt;
  &lt;!DOCTYPE hibernate-configuration PUBLIC
  "-//Hibernate/Hibernate Configuration DTD//EN"
  "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd"&gt;
  
  &lt;hibernate-configuration&gt;
  &lt;session-factory&gt;
      &lt;mapping class="com.company.hibernate.Person" /&gt;
  &lt;/session-factory&gt;
  
  &lt;/hibernate-configuration&gt;
  </code></pre>
  
  <h2>PersonServiceImpl.java</h2>
  
  <pre><code>@Service
  public class PersonServiceImpl implements PersonService {
  
  @Autowired
  private PersonDAO personDAO;
  
  public void addPerson(Person person) {
      personDAO.addPerson(person);
  }
  
  public List&lt;Person&gt; listPerson() {
      return personDAO.listPerson();
  }
  
  public void removePerson(Integer id) {
      personDAO.removePerson(id);
  }
  }
  </code></pre>
  
  <h2>PersonDAOImpl.java</h2>
  
  <pre><code>@Repository
  public class PersonDAOImpl implements PersonDAO {
  @Autowired
  private SessionFactory sessionFactory;
  
      @Transactional
  public void addPerson(Person person) {
      sessionFactory.getCurrentSession().save(person);
  }
      @Transactional
  public List&lt;Person&gt; listPerson() {
      return sessionFactory.getCurrentSession().createQuery("from Person").list();
  }
      @Transactional
  public void removePerson(Integer id) {
      Person person = (Person) sessionFactory.getCurrentSession().load(Person.class, id);
      if (null != person) {
          sessionFactory.getCurrentSession().delete(person);
      }
  }
  }
  </code></pre>
  
  <h2>PersonController.java</h2>
  
  <pre><code>@Controller
  public class PersonController {
  
  private PersonService personService = new PersonServiceImpl();
  
  @RequestMapping("/list")
  public String listContacts(Map&lt;String, Object&gt; map) {
  
      map.put("person", new Person());
      map.put("personList", personService.listPerson());
  
      return "person";
  }
  
  @RequestMapping(value = "/add", method = RequestMethod.POST)
  public String addPerson(@ModelAttribute("person")
      Person person, BindingResult result) {
  
      personService.addPerson(person);
  
      return "redirect:/list";
  }
  
  @RequestMapping("/delete/{contactId}")
  public String deleteContact(@PathVariable("personId")
  Integer personId) {
  
      personService.removePerson(personId);
  
      return "redirect:/list";
  }
  }
  </code></pre>
  
  <h2>Person.java</h2>
  
  <pre><code>@Entity
  @Table(name = "PERSON")
  public class Person {
  
  @Id
  @Column(name="ID")
  private int id;
  
  @Column(name="first_name")
  private String firstName;
  
  @Column(name="last_name")
  private String lastName;
  
  public Person() {
  }
  
  public Person(String fname, String lname) {
      this.firstName = fname;
      this.lastName = lname;
  }
  
  public int getId() {
      return id;
  }
  
  public void setId(int id) {
      this.id = id;
  }
  
  public String getFirstName() {
      return firstName;
  }
  
  public void setFirstName(String first_name) {
      this.firstName = first_name;
  }
  
  public String getLastName() {
      return lastName;
  }
  
  public void setLastName(String last_name) {
      this.lastName = last_name;
  }
  }
  </code></pre>
  
  <h2>Person.hbm.xml</h2>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;!DOCTYPE hibernate-mapping PUBLIC 
  "-//Hibernate/Hibernate Mapping DTD//EN"
  "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd"&gt; 
  
  &lt;hibernate-mapping&gt;
   &lt;class name="Person" table="PERSON"&gt;
    &lt;meta attribute="class-description"&gt;
       This class contains the person detail. 
    &lt;/meta&gt;
    &lt;id name="id" type="int" column="id"&gt;
       &lt;generator class="native"/&gt;
    &lt;/id&gt;
    &lt;property name="firstName" column="first_name" type="string"/&gt;
    &lt;property name="lastName" column="last_name" type="string"/&gt;
   &lt;/class&gt;
  &lt;/hibernate-mapping&gt;
  </code></pre>
  
  <p>Somehow the Autowired doesn't work. Logging at tomcat log, there is no error. The only thing looks suspicious is the "Reject" lines:</p>
  
  <pre><code>Jan 31, 2014 5:52:26 PM org.springframework.web.servlet.handler.AbstractDetectingUrlHandlerMapping detectHandlers
  FINE: Rejected bean name 'org.springframework.context.annotation.internalConfigurationAnnotationProcessor': no URL paths identified
  Jan 31, 2014 5:52:26 PM org.springframework.web.servlet.handler.AbstractDetectingUrlHandlerMapping detectHandlers
  FINE: Rejected bean name 'org.springframework.context.annotation.internalAutowiredAnnotationProcessor': no URL paths identified
  ...
  Jan 31, 2014 5:52:27 PM org.springframework.web.servlet.handler.AbstractDetectingUrlHandlerMapping detectHandlers
  FINE: Rejected bean name 'personServiceImpl': no URL paths identified
  Jan 31, 2014 5:52:27 PM org.springframework.web.servlet.handler.AbstractDetectingUrlHandlerMapping detectHandlers
  FINE: Rejected bean name 'personDAOImpl': no URL paths identified
  Jan 31, 2014 5:52:27 PM org.springframework.web.servlet.handler.AbstractDetectingUrlHandlerMapping detectHandlers
  FINE: Rejected bean name 'propertyConfigurer': no URL paths identified
  Jan 31, 2014 5:52:27 PM org.springframework.web.servlet.handler.AbstractDetectingUrlHandlerMapping detectHandlers
  FINE: Rejected bean name 'dataSource': no URL paths identified
  Jan 31, 2014 5:52:27 PM org.springframework.web.servlet.handler.AbstractDetectingUrlHandlerMapping detectHandlers
  FINE: Rejected bean name 'sessionFactory': no URL paths identified
  Jan 31, 2014 5:52:27 PM org.springframework.web.servlet.handler.AbstractDetectingUrlHandlerMapping detectHandlers
  FINE: Rejected bean name 'transactionManager': no URL paths identified
  </code></pre>
  
  <p>But when I access <a href="http://tomcat2-gyw97.rhcloud.com/myprj/list" rel="nofollow">http://tomcat2-gyw97.rhcloud.com/myprj/list</a>, the log spits out NPE:</p>
  
  <pre><code>FINE: Resolving exception from handler [com.company.controller.PersonController@1cfa07a]: java.lang.NullPointerException
  Feb 01, 2014 10:57:09 AM org.springframework.web.servlet.FrameworkServlet processRequest
  FINE: Could not complete request
  java.lang.NullPointerException
          at com.company.service.PersonServiceImpl.listPerson(PersonServiceImpl.java:35)
          at com.company.controller.PersonController.listContacts(PersonController.java:27)
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  ...
  </code></pre>
  
  <p>Any help would be greatly appreciated. Thanks</p>