title: Property 'dataSource' is required Error in java (Spring)
body: <p>I am developing an web application in <strong><em>Java (Spring)</em></strong></p>
  
  <p>My java file is as,</p>
  
  <pre><code>try
      {
          JdbcTemplate jt = new JdbcTemplate(dataSource);
  
          System.out.println("Connection ....."+jt.toString());
  
          Connection conn;
          Statement st;
          conn =DriverManager.getConnection(jt.toString());
          conn = (Connection) jt.getDataSource();
          st=conn.createStatement();
          System.out.println("Connection created....."+st);
      }
      catch (Exception e) {
           System.out.println("Error Found...."+ e.getMessage());
           System.out.println("Strack Trace....."+e.getStackTrace());
      }
  </code></pre>
  
  <p>My <strong>spring-servlet.xml</strong> file is as,</p>
  
  <pre><code>&lt;bean id="dataSource"
      class="org.springframework.jdbc.datasource.DriverManagerDataSource"&gt;
      &lt;property name="driverClassName" value="com.mysql.jdbc.Driver" /&gt;
      &lt;property name="url" value="jdbc:mysql://localhost:3306/cjbranchdb" /&gt;
      &lt;property name="username" value="root" /&gt;
      &lt;property name="password" value="root" /&gt;
  &lt;/bean&gt;
  &lt;bean id="JdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate"&gt; 
      &lt;property name="dataSource"&gt;&lt;ref bean="dataSource"/&gt;&lt;/property&gt; 
  &lt;/bean&gt; 
  </code></pre>
  
  <p>But it gets an error as,</p>
  
  <pre><code>Error Found: Property 'dataSource' is required.
  Strack Trace: [Ljava.lang.StackTraceElement;@7948dd
  </code></pre>
  
  <p>Here, I want to make a connection in Java file and pass it to the another variable as Jasper Report.</p>
  
  <p>Please help, How to fix this issue?</p>