title: JDBC Datasource returning NULL
body: <p>I have this working java code that serve as the "datasource":</p>
  
  <pre><code>public final class PMF {
          static Driver driver = null;
      static String url = "jdbc:jiql://local";
  
      static Properties props = new Properties();
  
      static {
         String password = "jiql";
         String user = "admin";
         props.put("user",user);
         props.put("password",password);
         try {
             Class clazz = Class.forName("org.jiql.jdbc.Driver");
             driver = (Driver) clazz.newInstance();
         } catch (Exception e){
             e.printStackTrace();
         }
      }
  
      public static Connection get() {
          try{
              return driver.connect(url,props);
          } catch (java.sql.SQLException e){
              e.printStackTrace();
          }
          return null;
      }
  }
  </code></pre>
  
  <p>When I tried to adapt this code for Spring with the code below:</p>
  
  <p><strong>jdbc.properties</strong></p>
  
  <pre><code>jdbc.driverClassName=org.jiql.jdbc.Driver
  
  # development
  jdbc.url=jdbc:jiql://local
  jdbc.username=admin
  jdbc.password=jiql
  </code></pre>
  
  <p><strong>applicationContext.xml</strong></p>
  
  <pre><code>&lt;!-- placeholders --&gt;
  &lt;bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"&gt;
      &lt;property name="locations" value="/WEB-INF/jdbc.properties"/&gt;
  &lt;/bean&gt;
  
  &lt;!-- data source --&gt;
  &lt;bean id="dataSource" destroy-method="close" class="org.apache.commons.dbcp.BasicDataSource"&gt;
      &lt;property name="driverClassName" value="${jdbc.driverClassName}"/&gt;
      &lt;property name="url" value="${jdbc.url}"/&gt;
      &lt;property name="username" value="${jdbc.username}"/&gt;
      &lt;property name="password" value="${jdbc.password}"/&gt;
  &lt;/bean&gt; 
  </code></pre>
  
  <p>The "datasource" gets null when I do this in the DAO:</p>
  
  <pre><code>@Autowired
  private DataSource dataSource;
  </code></pre>
  
  <p>What could be causing the datasource to be null? </p>